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

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

void uint64_unpack_big (char const *s, uint64 *u)
{
  uint64 r = T8((unsigned char)s[0]) ; r <<= 8 ;
  r += T8((unsigned char)s[1]) ; r <<= 8 ;
  r += T8((unsigned char)s[2]) ; r <<= 8 ;
  r += T8((unsigned char)s[3]) ; r <<= 8 ;
  r += T8((unsigned char)s[4]) ; r <<= 8 ;
  r += T8((unsigned char)s[5]) ; r <<= 8 ;
  r += T8((unsigned char)s[6]) ; r <<= 8 ;
  r += T8((unsigned char)s[7]) ;
  *u = r ;
}