Show More
@@ -9,26 +9,21 b' static inline uint32_t getbe32(const cha' | |||
|
9 | 9 | { |
|
10 | 10 | const unsigned char *d = (const unsigned char *)c; |
|
11 | 11 | |
|
12 | return ((d[0] << 24) | | |
|
13 | (d[1] << 16) | | |
|
14 | (d[2] << 8) | | |
|
15 | (d[3])); | |
|
12 | return ((d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3])); | |
|
16 | 13 | } |
|
17 | 14 | |
|
18 | 15 | static inline int16_t getbeint16(const char *c) |
|
19 | 16 | { |
|
20 | 17 | const unsigned char *d = (const unsigned char *)c; |
|
21 | 18 | |
|
22 | return ((d[0] << 8) | | |
|
23 | (d[1])); | |
|
19 | return ((d[0] << 8) | (d[1])); | |
|
24 | 20 | } |
|
25 | 21 | |
|
26 | 22 | static inline uint16_t getbeuint16(const char *c) |
|
27 | 23 | { |
|
28 | 24 | const unsigned char *d = (const unsigned char *)c; |
|
29 | 25 | |
|
30 | return ((d[0] << 8) | | |
|
31 | (d[1])); | |
|
26 | return ((d[0] << 8) | (d[1])); | |
|
32 | 27 | } |
|
33 | 28 | |
|
34 | 29 | static inline void putbe32(uint32_t x, char *c) |
@@ -36,7 +31,7 b' static inline void putbe32(uint32_t x, c' | |||
|
36 | 31 | c[0] = (x >> 24) & 0xff; |
|
37 | 32 | c[1] = (x >> 16) & 0xff; |
|
38 | 33 | c[2] = (x >> 8) & 0xff; |
|
39 |
c[3] = (x) |
|
|
34 | c[3] = (x)&0xff; | |
|
40 | 35 | } |
|
41 | 36 | |
|
42 | 37 | static inline double getbefloat64(const char *c) |
@@ -46,7 +41,7 b' static inline double getbefloat64(const ' | |||
|
46 | 41 | int i; |
|
47 | 42 | uint64_t t = 0; |
|
48 | 43 | for (i = 0; i < 8; i++) { |
|
49 | t = (t<<8) + d[i]; | |
|
44 | t = (t << 8) + d[i]; | |
|
50 | 45 | } |
|
51 | 46 | memcpy(&ret, &t, sizeof(t)); |
|
52 | 47 | return ret; |
General Comments 0
You need to be logged in to leave comments.
Login now