Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static inline int printbinary(char *buf, unsigned long x, int nbits)
- {
- unsigned long mask = 1UL << (nbits - 1);
- while (mask != 0) {
- *buf++ = (mask & x ? '1' : '0');
- mask >>= 1;
- }
- *buf = '\0';
- return nbits;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement