Skip to content

Instantly share code, notes, and snippets.

@cypreess
Forked from anonymous/gist:4267472
Created December 12, 2012 14:27
Show Gist options
  • Save cypreess/4268138 to your computer and use it in GitHub Desktop.
Save cypreess/4268138 to your computer and use it in GitHub Desktop.
cypreess@iMac ~ cat f.cc
#include <stdio.h>
int main(){
unsigned char a = 255;
unsigned long int b = (a << 24);
unsigned long int c = ((unsigned long int) a << 24);
printf("b=%lu\n", b);
printf("c=%lu\n", c);
return 0;
}
cypreess@iMac ~ g++ f.cc -o f && ./f
b=18446744073692774400
c=4278190080
cypreess@iMac ~ python -c "print 255<<24"
4278190080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment