Skip to content

Instantly share code, notes, and snippets.

@houmei
Created October 8, 2013 19:00
Show Gist options
  • Save houmei/6889756 to your computer and use it in GitHub Desktop.
Save houmei/6889756 to your computer and use it in GitHub Desktop.
GNU-APL1.0 for MacOSX trial
#define __swap64gen(x) \
(__uint64_t)((((__uint64_t)(x) & 0xff) << 56) | \
((__uint64_t)(x) & 0xff00ULL) << 40 | \
((__uint64_t)(x) & 0xff0000ULL) << 24 | \
((__uint64_t)(x) & 0xff000000ULL) << 8 | \
((__uint64_t)(x) & 0xff00000000ULL) >> 8 | \
((__uint64_t)(x) & 0xff0000000000ULL) >> 24 | \
((__uint64_t)(x) & 0xff000000000000ULL) >> 40 | \
((__uint64_t)(x) & 0xff00000000000000ULL) >> 56)
#define htobe64 __swap64gen
#define be64toh __swap64gen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment