fehQlibs 26
Qlibs
Loading...
Searching...
No Matches
uint64p.c
Go to the documentation of this file.
1#include "uint_t.h"
2
10void uint64_pack(char s[8],uint64 u)
11{
12 s[0] = u & 255; u >>= 8;
13 s[1] = u & 255; u >>= 8;
14 s[2] = u & 255; u >>= 8;
15 s[3] = u & 255; u >>= 8;
16 s[4] = u & 255; u >>= 8;
17 s[5] = u & 255; u >>= 8;
18 s[6] = u & 255; u >>= 8;
19 s[7] = u & 255;
20}
21void uint64_pack_big(char s[8],uint64 u)
22{
23 s[7] = u & 255; u >>= 8;
24 s[6] = u & 255; u >>= 8;
25 s[5] = u & 255; u >>= 8;
26 s[4] = u & 255; u >>= 8;
27 s[3] = u & 255; u >>= 8;
28 s[2] = u & 255; u >>= 8;
29 s[1] = u & 255; u >>= 8;
30 s[0] = u & 255;
31}
32
33void uint64_unpack(char s[8],uint64 *u)
34{
35 uint64 result;
36
37 result = (unsigned char) s[7]; result <<= 8;
38 result += (unsigned char) s[6]; result <<= 8;
39 result += (unsigned char) s[5]; result <<= 8;
40 result += (unsigned char) s[4]; result <<= 8;
41 result += (unsigned char) s[3]; result <<= 8;
42 result += (unsigned char) s[2]; result <<= 8;
43 result += (unsigned char) s[1]; result <<= 8;
44 result += (unsigned char) s[0];
45
46 *u = result;
47}
48void uint64_unpack_big(char s[8],uint64 *u)
49{
50 uint64 result;
51
52 result = (unsigned char) s[0]; result <<= 8;
53 result += (unsigned char) s[1]; result <<= 8;
54 result += (unsigned char) s[2]; result <<= 8;
55 result += (unsigned char) s[3]; result <<= 8;
56 result += (unsigned char) s[4]; result <<= 8;
57 result += (unsigned char) s[5]; result <<= 8;
58 result += (unsigned char) s[6]; result <<= 8;
59 result += (unsigned char) s[7];
60
61 *u = result;
62}
void uint64_pack(char s[8], uint64 u)
Definition: uint64p.c:10
void uint64_pack_big(char s[8], uint64 u)
Definition: uint64p.c:21
void uint64_unpack(char s[8], uint64 *u)
Definition: uint64p.c:33
void uint64_unpack_big(char s[8], uint64 *u)
Definition: uint64p.c:48
additional types and pack routines
unsigned long long uint64
Definition: uint_t.h:54