diff options
Diffstat (limited to 'toxcore/util.c')
-rw-r--r-- | toxcore/util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/toxcore/util.c b/toxcore/util.c index 23e19290..3d444b07 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -93,6 +93,15 @@ uint16_t lendian_to_host16(uint16_t lendian) | |||
93 | #endif | 93 | #endif |
94 | } | 94 | } |
95 | 95 | ||
96 | void host_to_lendian32(uint8_t *dest, uint32_t num) | ||
97 | { | ||
98 | #ifdef WORDS_BIGENDIAN | ||
99 | num = ((num << 8) & 0xFF00FF00 ) | ((num >> 8) & 0xFF00FF ); | ||
100 | num = (num << 16) | (num >> 16); | ||
101 | #endif | ||
102 | memcpy(dest, &num, sizeof(uint32_t)); | ||
103 | } | ||
104 | |||
96 | void lendian_to_host32(uint32_t *dest, const uint8_t *lendian) | 105 | void lendian_to_host32(uint32_t *dest, const uint8_t *lendian) |
97 | { | 106 | { |
98 | uint32_t d; | 107 | uint32_t d; |