Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

modulo vs bitwise mask

Language: Editor: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.62 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0,77 sec 
edit mode |  history
0 & 0xFF = 0 and 0 % 256 = 0
1 & 0xFF = 1 and 1 % 256 = 1
255 & 0xFF = 255 and 255 % 256 = 255
256 & 0xFF = 0 and 256 % 256 = 0
-1 & 0xFF = 255 and -1 % 256 = -1
-255 & 0xFF = 1 and -255 % 256 = -255
-256 & 0xFF = 0 and -256 % 256 = 0