Skip to content

Instantly share code, notes, and snippets.

@xxuejie
Created January 18, 2013 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxuejie/4562006 to your computer and use it in GitHub Desktop.
Save xxuejie/4562006 to your computer and use it in GitHub Desktop.
__builtin_bswap64 bug
$ clang swap64.c
$ ./a.out
72057594037927936
$ emcc swap64.c
$ node a.out.js
72057594037927940
#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