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

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

void uint32_unpack (char const *s, uint32 *u)
{
  uint32 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 ;
}