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

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

void uint32_unpack (char const *s, uint32_t *u)
{
  uint32_t r = T8((unsigned char)s[3]) ; r <<= 8 ;
  r += T8((unsigned char)s[2]) ; r <<= 8 ;
  r += T8((unsigned char)s[1]) ; r <<= 8 ;
  r += T8((unsigned char)s[0]) ;
  *u = r ;
}