C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Miscellaneous sample source codes
Reverse bit order in an integer
Reverse bit order in an integer #include <stdio.h> static unsigned long reverse(unsigned long x) { unsigned long h = 0; int i = 0; for(h = i = 0; i < 32; i++) { h = (h << 1) + (x & 1); x >>= 1; } return h; }
Privacy Policy
|
Link to Us
|
Links