Unless I'm misreading the code (which may very well be), the function looks like: if (mask_bitmap && m) { if (this or that) { do X fill_bits(...) } else { fill_bits(...) } } So essentially, if the condition (mask_bitmap && m) is NOT met, we do not fill the bits. Which means we are sending garbage over the wire? Y.