Speedier implementation with bit masking