compression: Fix writing output flags
[samba.git] / lib / compression / lzxpress.c
index 5e52fa8b669c820de3b7082b8537d70adafddc41..7ee2e9e5d5646a8701fbb771b3113f2f3f11be6b 100644 (file)
@@ -202,8 +202,10 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
                }
        }
 
-       indic <<= 32 - indic_bit;
-       indic |= (1 << (32 - indic_bit)) - 1;
+       if (indic_bit != 0) {
+               indic <<= 32 - indic_bit;
+       }
+       indic |= UINT32_MAX >> indic_bit;
        PUSH_LE_U32(compressed, indic_pos, indic);
 
        return compressed_pos;