summaryrefslogtreecommitdiff
path: root/src/libstddjb/uint16_unpack.c
blob: 14976718e65607cb6a7504db2ee4f3372f4f1c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <stdint.h>
#include <skalibs/uint16.h>
#include <skalibs/bytestr.h>

void uint16_unpack (char const *s, uint16_t *u)
{
  uint16_t r = T8((unsigned char)s[1]) ; r <<= 8 ;
  r += T8((unsigned char)s[0]) ;
  *u = r ;
}