62 #ifndef BYTEUTILITIES_H_ 63 #define BYTEUTILITIES_H_ 76 unsigned char* uBuffer = (
unsigned char*) buffer;
77 return (uBuffer[0] << 8)| (uBuffer[1]);
82 unsigned char* uBuffer = (
unsigned char*) buffer;
83 return ((uBuffer[0] << 24) | (uBuffer[1] << 16) | (uBuffer[2] << 8)
88 unsigned int highWord =
readInt(buffer);
89 unsigned int lowWord =
readInt(buffer + 4);
90 uint64_t combined = (((uint64_t) highWord) << 32) | lowWord;
96 unsigned short utoWrite = ToWrite;
97 buffer[0] = (utoWrite &
MASK_1) >> 8;
98 buffer[1] = utoWrite &
MASK_0;
103 unsigned int utoWrite = ToWrite;
105 buffer[0] = (utoWrite &
MASK_3) >> 24;
106 buffer[1] = (utoWrite &
MASK_2) >> 16;
107 buffer[2] = (utoWrite &
MASK_1) >> 8;
108 buffer[3] = utoWrite &
MASK_0;
112 uint64_t utoWrite = ToWrite;
113 buffer[0] = (utoWrite &
MASK_7) >> 56;
114 buffer[1] = (utoWrite &
MASK_6) >> 48;
115 buffer[2] = (utoWrite &
MASK_5) >> 40;
116 buffer[3] = (utoWrite &
MASK_4) >> 32;
117 buffer[4] = (utoWrite &
MASK_3) >> 24;
118 buffer[5] = (utoWrite &
MASK_2) >> 16;
119 buffer[6] = (utoWrite &
MASK_1) >> 8;
120 buffer[7] = utoWrite &
MASK_0;
124 union {
double d; Long l;} dbLgConv;
130 union {
double d; Long l;} dbLgConv;
137 static const uint64_t
MASK_4 = 0x000000FF00000000ULL,
139 0xFF00000000000000ULL;
static const unsigned int MASK_2
static const uint64_t MASK_7
static const uint64_t MASK_5
static const unsigned int MASK_3
static void writeInt(char *buffer, int ToWrite)
static const unsigned int MASK_1
static const unsigned int MASK_0
static const uint64_t MASK_6
static int64_t readLong(char *buffer)
static Long convertDoubleToLong(double d)
static const uint64_t MASK_4
static int readInt(char *buffer)
static short readShort(char *buffer)
static void writeLong(char *buffer, int64_t ToWrite)
static double convertLongToDouble(Long l)
static void writeShort(char *buffer, short ToWrite)