diff options
Diffstat (limited to 'src/libstddjb/uint16_unpack_big.c')
-rw-r--r-- | src/libstddjb/uint16_unpack_big.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstddjb/uint16_unpack_big.c b/src/libstddjb/uint16_unpack_big.c index 73b94da..3f6f0df 100644 --- a/src/libstddjb/uint16_unpack_big.c +++ b/src/libstddjb/uint16_unpack_big.c @@ -1,12 +1,12 @@ /* ISC license. */ #include <stdint.h> +#include <string.h> #include <skalibs/uint16.h> -#include <skalibs/bytestr.h> void uint16_unpack_big (char const *s, uint16_t *u) { - uint16_t r = T8((unsigned char)s[0]) ; r <<= 8 ; - r += T8((unsigned char)s[1]) ; - *u = r ; + uint16_t x ; + memcpy(&x, s, sizeof(uint16_t)) ; + *u = uint16_big(x) ; } |