Boundary checking system, fixed order of operations issue with bitmasking