1#ifndef MY_BYTEORDER_INCLUDED
2#define MY_BYTEORDER_INCLUDED
41#ifdef HAVE_ARPA_INET_H
49#if defined(_WIN32) && defined(WIN32_LEAN_AND_MEAN)
66 return ((
int32)(((A[2]) & 128)
113 *(T + 1) = (
uchar)(A >> 8);
114 *(T + 2) = (
uchar)(A >> 16);
119 *(T + 1) = (
uchar)(A >> 8);
120 *(T + 2) = (
uchar)(A >> 16);
121 *(T + 3) = (
uchar)(A >> 24);
122 *(T + 4) = (
uchar)(A >> 32);
127 *(T + 1) = (
uchar)(A >> 8);
128 *(T + 2) = (
uchar)(A >> 16);
129 *(T + 3) = (
uchar)(A >> 24);
130 *(T + 4) = (
uchar)(A >> 32);
131 *(T + 5) = (
uchar)(A >> 40);
137 return sint2korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
141 return uint2korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
145 return uint3korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
149 return sint3korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
153 return uint4korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
157 return sint4korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
161 return uint6korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
165 return uint8korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
169 return sint8korr(
static_cast<const uchar *
>(
static_cast<const void *
>(pT)));
207 return float8get(
static_cast<const uchar *
>(
static_cast<const void *
>(
M)));
220 memcpy(&val, ptr,
sizeof(val));
225 memcpy(ptr, &val,
sizeof(val));
230 memcpy(&val, ptr,
sizeof(val));
235 memcpy(ptr, &val,
sizeof(val));
240 memcpy(&val, ptr,
sizeof(val));
246 memcpy(&val, ptr,
sizeof(val));
251 memcpy(ptr, &val,
sizeof(val));
256 memcpy(&val, ptr,
sizeof(val));
264 memcpy(&val, ptr,
sizeof(val));
270 memcpy(&val, ptr,
sizeof(val));
275 memcpy(ptr, &val,
sizeof(val));
287 memcpy(&val, ptr,
sizeof(val));
293 memcpy(&val, ptr,
sizeof(val));
300 val = _byteswap_ushort(val);
304 memcpy(ptr, &val,
sizeof(val));
305 return ptr +
sizeof(val);
310 memcpy(ptr, &val,
sizeof(val));
311 return ptr +
sizeof(val);
317 return load16be(pointer_cast<const char *>(ptr));
321 return load32be(pointer_cast<const char *>(ptr));
325 return pointer_cast<uchar *>(
store16be(pointer_cast<char *>(ptr), val));
329 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:73
Data in little-endian format.
static int32 sint3korr(const uchar *A)
Definition: my_byteorder.h:65
ALWAYS_INLINE char * store16be(char *ptr, uint16 val)
Definition: my_byteorder.h:297
void float8store(char *V, double M)
Definition: my_byteorder.h:210
double float8get(const char *M)
Definition: my_byteorder.h:206
double doubleget(const uchar *ptr)
Definition: my_byteorder.h:228
void longlongstore(uchar *ptr, longlong val)
Definition: my_byteorder.h:274
void float4store(char *V, float M)
Definition: my_byteorder.h:202
float floatget(const uchar *ptr)
Definition: my_byteorder.h:218
int32 longget(const uchar *ptr)
Definition: my_byteorder.h:254
longlong longlongget(const uchar *ptr)
Definition: my_byteorder.h:268
static ulonglong uint7korr(const uchar *A)
Definition: my_byteorder.h:90
void shortstore(uchar *ptr, int16 val)
Definition: my_byteorder.h:250
static void int6store(uchar *T, ulonglong A)
Definition: my_byteorder.h:125
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:180
int16 sint2korr(const char *pT)
Definition: my_byteorder.h:136
uint16 load16be(const char *ptr)
Definition: my_byteorder.h:285
int16 shortget(const uchar *ptr)
Definition: my_byteorder.h:244
ulonglong uint8korr(const char *pT)
Definition: my_byteorder.h:164
static ulonglong uint6korr(const uchar *A)
Definition: my_byteorder.h:84
static void int5store(uchar *T, ulonglong A)
Definition: my_byteorder.h:117
static void int3store(uchar *T, uint A)
int3store
Definition: my_byteorder.h:111
void int8store(char *pT, ulonglong A)
Definition: my_byteorder.h:192
char * store32be(char *ptr, uint32 val)
Definition: my_byteorder.h:308
static uint32 uint3korr(const uchar *A)
Definition: my_byteorder.h:73
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:152
int32 sint4korr(const char *pT)
Definition: my_byteorder.h:156
uint16 uint2korr(const char *pT)
Definition: my_byteorder.h:140
void longstore(uchar *ptr, int32 val)
Definition: my_byteorder.h:260
longlong sint8korr(const char *pT)
Definition: my_byteorder.h:168
uint16 ushortget(const uchar *ptr)
Definition: my_byteorder.h:238
static ulonglong uint5korr(const uchar *A)
Definition: my_byteorder.h:78
void floatstore(uchar *ptr, float val)
Definition: my_byteorder.h:224
uint32 ulongget(const uchar *ptr)
Definition: my_byteorder.h:262
uint32 load32be(const char *ptr)
Definition: my_byteorder.h:291
void int2store(char *pT, uint16 A)
Definition: my_byteorder.h:172
void doublestore(uchar *ptr, double val)
Definition: my_byteorder.h:234
Header for compiler-dependent features.
#define ALWAYS_INLINE
Definition: my_compiler.h:99
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
int16_t int16
Definition: my_inttypes.h:64
int32_t int32
Definition: my_inttypes.h:66
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67