35 #elif !defined(__APPLE__)
47 static uint8_t
swap(uint8_t val)
52 static int8_t
swap(int8_t val)
57 static uint16_t
swap(uint16_t val)
59 return _byteswap_ushort(val);
62 static int16_t
swap(int16_t val)
64 return (int16_t)
swap((uint16_t)val);
67 static uint32_t
swap(uint32_t val)
69 return _byteswap_ulong(val);
72 static int32_t
swap(int32_t val)
74 return (int32_t)
swap((uint32_t)val);
77 static uint64_t
swap(uint64_t val)
79 return _byteswap_uint64(val);
82 static int64_t
swap(int64_t val)
84 return (int64_t)
swap((uint64_t)val);
87 static float swap(
float val)
92 static double swap(
double val)
98 #elif defined(HAS_BYTESWAP)
103 static uint8_t
swap(uint8_t val)
113 static uint16_t
swap(uint16_t val)
116 return bswap_16(val);
118 return __bswap_16(val);
122 static int16_t
swap(int16_t val)
124 return (int16_t)
swap((uint16_t)val);
127 static uint32_t
swap(uint32_t val)
130 return bswap_32(val);
132 return __bswap_32(val);
136 static int32_t
swap(int32_t val)
138 return (int32_t)
swap((uint32_t)val);
141 static uint64_t
swap(uint64_t val)
144 return bswap_64(val);
146 return __bswap_64(val);
150 static int64_t
swap(int64_t val)
152 return (int64_t)
swap((uint64_t)val);
171 static uint8_t
swap(uint8_t val)
176 static int8_t
swap(int8_t val)
181 static uint16_t
swap(uint16_t val)
183 return (val << 8) | (val >> 8);
186 static int16_t
swap(int16_t val)
188 return (val << 8) | ((val >> 8) & 0xFF);
191 static uint32_t
swap(uint32_t val)
193 val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
194 return (val << 16) | (val >> 16);
197 static int32_t
swap(int32_t val)
199 val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
200 return (val << 16) | ((val >> 16) & 0xFFFF);
203 static uint64_t
swap(uint64_t val)
205 val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL);
206 val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL);
207 return (val << 32) | (val >> 32);
210 static int64_t
swap(int64_t val)
212 val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL);
213 val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL);
214 return (val << 32) | ((val >> 32) & 0xFFFFFFFFULL);
217 static float swap(
float val)
222 static double swap(
double val)
static uint32_t swap(uint32_t val)
Definition: endian.h:127
static uint8_t swap(uint8_t val)
Definition: endian.h:103
static uint64_t swap(uint64_t val)
Definition: endian.h:141
static double swap(double val)
Definition: endian.h:160
static float swap(float val)
Definition: endian.h:155
static int8_t swap(int8_t val)
Definition: endian.h:108
static int16_t swap(int16_t val)
Definition: endian.h:122
Definition: Application/application.h:35
static int64_t swap(int64_t val)
Definition: endian.h:150
static uint16_t swap(uint16_t val)
Definition: endian.h:113
static int32_t swap(int32_t val)
Definition: endian.h:136