Skip to content

Instantly share code, notes, and snippets.

@azat
Created March 26, 2014 22:21
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 azat/9794982 to your computer and use it in GitHub Desktop.
Save azat/9794982 to your computer and use it in GitHub Desktop.
typedef unsigned char u8;
static inline uint64_t bswapu64(uint64_t a)
{
uint64_t b = 0;
for (u8 i = 0; i < sizeof(uint64_t); ++i) {
b = (b << __CHAR_BIT__) | (u8)a;
a >>= __CHAR_BIT__;
}
return b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment