This is a value that has exactly one bit:
00000000000000000000000001000000
That way you can also have, say, GAMEPAD_RIGHT=0x0010 , and you can OR evaluate and test any of them regardless of AND'ing. This is very common in games, especially on mobile devices.
The purpose of this coding is to optimize the space and the ability to test various cases on one line.
Using one bit for, say, all possible gamepad keys, you can represent on one int (even one byte in the old 8-bit days of the console, where the console has very few keys) the state of each key (it is either 'on' or 'off ').
UP + RIGHT, while holding down the key:
00000000000000000000000001000000 OR 00000000000000000000000000010000 = 00000000000000000000000001010000
Gugussee
source share