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

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

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