Created
January 18, 2013 02:53
-
-
Save xxuejie/4562006 to your computer and use it in GitHub Desktop.
__builtin_bswap64 bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ clang swap64.c | |
$ ./a.out | |
72057594037927936 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ emcc swap64.c | |
$ node a.out.js | |
72057594037927940 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
int main() { | |
int64_t a = 1; | |
a = __builtin_bswap64(a); | |
printf("%lld\n", a); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment