Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void dtob(unsigned int n);
- int main(void) {
- dtob((char)-100);
- printf("%p\n", (char)-100);
- dtob((unsigned char)-100);
- printf("%p\n", (unsigned char)-100);
- dtob((short int)-100);
- printf("%p\n", (short int)-100);
- dtob((unsigned short int)-100);
- printf("%p\n", (unsigned short int)-100);
- dtob((int)-100);
- printf("%p\n", (int)-100);
- dtob((unsigned int)-100);
- printf("%p\n", (unsigned int)-100);
- return 0;
- }
- int invertebits(x, p, n) unsigned x, p, n; {
- //while(n--)x>>--p&1?x&=~(1<<p):(x|=1<<p);
- return x^~(~0<<n)<<p-n;
- }
- void dtob(unsigned int n) {
- char i=0;
- do{putchar((n>>31&1)+'0');}while((n<<=1)|++i<32);
- putchar(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment