I think you can just xor the whitespace mask with the shifted one.
Also, when counting 0xFF bytes from a boolean etc., sub the mask; 0xFF == -1.