simplified bitwise operations

Simplified bitwise operations for added clarity and maintainability.