1 unsigned long long __cdecl _byteswap_uint64(unsigned long long _Int64);
2 
_byteswap_uint64(unsigned long long _Int64)3 unsigned long long __cdecl _byteswap_uint64(unsigned long long _Int64)
4 {
5 #if defined(_AMD64_) || defined(__x86_64__)
6   unsigned long long retval;
7   __asm__ __volatile__ ("bswapq %[retval]" : [retval] "=rm" (retval) : "[retval]" (_Int64));
8   return retval;
9 #elif defined(_X86_) || defined(__i386__)
10   union {
11     long long int64part;
12     struct {
13       unsigned long lowpart;
14       unsigned long hipart;
15     };
16   } retval;
17   retval.int64part = _Int64;
18   __asm__ __volatile__ ("bswapl %[lowpart]\n"
19     "bswapl %[hipart]\n"
20     : [lowpart] "=rm" (retval.hipart), [hipart] "=rm" (retval.lowpart)  : "[lowpart]" (retval.lowpart), "[hipart]" (retval.hipart));
21   return retval.int64part;
22 #else
23   unsigned char *b = (void*)&_Int64;
24   unsigned char tmp;
25   tmp = b[0];
26   b[0] = b[7];
27   b[7] = tmp;
28   tmp = b[1];
29   b[1] = b[6];
30   b[6] = tmp;
31   tmp = b[2];
32   b[2] = b[5];
33   b[5] = tmp;
34   tmp = b[3];
35   b[3] = b[4];
36   b[4] = tmp;
37   return _Int64;
38 #endif
39 }
40