1#ifndef MY_BYTEORDER_INCLUDED
2#define MY_BYTEORDER_INCLUDED
40#ifdef HAVE_ARPA_INET_H
48#if defined(_WIN32) && defined(WIN32_LEAN_AND_MEAN)
65 return ((
int32)(((A[2]) & 128)
112 *(T + 1) = (
uchar)(A >> 8);
113 *(T + 2) = (
uchar)(A >> 16);
118 *(T + 1) = (
uchar)(A >> 8);
119 *(T + 2) = (
uchar)(A >> 16);
120 *(T + 3) = (
uchar)(A >> 24);
121 *(T + 4) = (
uchar)(A >> 32);
126 *(T + 1) = (
uchar)(A >> 8);
127 *(T + 2) = (
uchar)(A >> 16);
128 *(T + 3) = (
uchar)(A >> 24);
129 *(T + 4) = (
uchar)(A >> 32);
130 *(T + 5) = (
uchar)(A >> 40);
136 return sint2korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
140 return uint2korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
144 return uint3korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
148 return sint3korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
152 return uint4korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
156 return sint4korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
160 return uint6korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
164 return uint8korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
168 return sint8korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
206 return float8get(
static_cast<const uchar *
>(
static_cast<const void *
>(
M)));
219 memcpy(&val, ptr,
sizeof(val));
224 memcpy(ptr, &val,
sizeof(val));
229 memcpy(&val, ptr,
sizeof(val));
234 memcpy(ptr, &val,
sizeof(val));
239 memcpy(&val, ptr,
sizeof(val));
245 memcpy(&val, ptr,
sizeof(val));
250 memcpy(ptr, &val,
sizeof(val));
255 memcpy(&val, ptr,
sizeof(val));
263 memcpy(&val, ptr,
sizeof(val));
269 memcpy(&val, ptr,
sizeof(val));
274 memcpy(ptr, &val,
sizeof(val));
286 memcpy(&val, ptr,
sizeof(val));
292 memcpy(&val, ptr,
sizeof(val));
299 val = _byteswap_ushort(val);
303 memcpy(ptr, &val,
sizeof(val));
304 return ptr +
sizeof(val);
309 memcpy(ptr, &val,
sizeof(val));
310 return ptr +
sizeof(val);
316 return load16be(pointer_cast<const char *>(ptr));
320 return load32be(pointer_cast<const char *>(ptr));
324 return pointer_cast<uchar *>(
store16be(pointer_cast<char *>(ptr), val));
328 return pointer_cast<uchar *>(
store32be(pointer_cast<char *>(ptr), val));
Endianness-independent definitions (little_endian.h contains optimized versions if you know you are o...
#define M
Definition: ctype-tis620.cc:72
Data in little-endian format.
static int32 sint3korr(const uchar *A)
Definition: my_byteorder.h:64
ALWAYS_INLINE char * store16be(char *ptr, uint16 val)
Definition: my_byteorder.h:296
void float8store(char *V, double M)
Definition: my_byteorder.h:209
double float8get(const char *M)
Definition: my_byteorder.h:205
double doubleget(const uchar *ptr)
Definition: my_byteorder.h:227
void longlongstore(uchar *ptr, longlong val)
Definition: my_byteorder.h:273
void float4store(char *V, float M)
Definition: my_byteorder.h:201
float floatget(const uchar *ptr)
Definition: my_byteorder.h:217
int32 longget(const uchar *ptr)
Definition: my_byteorder.h:253
longlong longlongget(const uchar *ptr)
Definition: my_byteorder.h:267
static ulonglong uint7korr(const uchar *A)
Definition: my_byteorder.h:89
void shortstore(uchar *ptr, int16 val)
Definition: my_byteorder.h:249
static void int6store(uchar *T, ulonglong A)
Definition: my_byteorder.h:124
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:179
int16 sint2korr(const char *pT)
Definition: my_byteorder.h:135
uint16 load16be(const char *ptr)
Definition: my_byteorder.h:284
int16 shortget(const uchar *ptr)
Definition: my_byteorder.h:243
ulonglong uint8korr(const char *pT)
Definition: my_byteorder.h:163
static ulonglong uint6korr(const uchar *A)
Definition: my_byteorder.h:83
static void int5store(uchar *T, ulonglong A)
Definition: my_byteorder.h:116
static void int3store(uchar *T, uint A)
int3store
Definition: my_byteorder.h:110
void int8store(char *pT, ulonglong A)
Definition: my_byteorder.h:191
char * store32be(char *ptr, uint32 val)
Definition: my_byteorder.h:307
static uint32 uint3korr(const uchar *A)
Definition: my_byteorder.h:72
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:151
int32 sint4korr(const char *pT)
Definition: my_byteorder.h:155
uint16 uint2korr(const char *pT)
Definition: my_byteorder.h:139
void longstore(uchar *ptr, int32 val)
Definition: my_byteorder.h:259
longlong sint8korr(const char *pT)
Definition: my_byteorder.h:167
uint16 ushortget(const uchar *ptr)
Definition: my_byteorder.h:237
static ulonglong uint5korr(const uchar *A)
Definition: my_byteorder.h:77
void floatstore(uchar *ptr, float val)
Definition: my_byteorder.h:223
uint32 ulongget(const uchar *ptr)
Definition: my_byteorder.h:261
uint32 load32be(const char *ptr)
Definition: my_byteorder.h:290
void int2store(char *pT, uint16 A)
Definition: my_byteorder.h:171
void doublestore(uchar *ptr, double val)
Definition: my_byteorder.h:233
Header for compiler-dependent features.
#define ALWAYS_INLINE
Definition: my_compiler.h:98
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
unsigned char uchar
Definition: my_inttypes.h:51
long long int longlong
Definition: my_inttypes.h:54
int16_t int16
Definition: my_inttypes.h:63
int32_t int32
Definition: my_inttypes.h:65
uint16_t uint16
Definition: my_inttypes.h:64
uint32_t uint32
Definition: my_inttypes.h:66