Skip to content
Newer
Older
100644 32 lines (25 sloc) 560 Bytes
3e25c70 import dnscache 1.00
D. J. Bernstein authored Mar 25, 2000
1 #include "uint32.h"
2
df36440 import djbdns 1.03
D. J. Bernstein authored Jan 6, 2001
3 void uint32_unpack(const char s[4],uint32 *u)
3e25c70 import dnscache 1.00
D. J. Bernstein authored Mar 26, 2000
4 {
5 uint32 result;
6
7 result = (unsigned char) s[3];
8 result <<= 8;
9 result += (unsigned char) s[2];
10 result <<= 8;
11 result += (unsigned char) s[1];
12 result <<= 8;
13 result += (unsigned char) s[0];
14
15 *u = result;
16 }
17
df36440 import djbdns 1.03
D. J. Bernstein authored Jan 7, 2001
18 void uint32_unpack_big(const char s[4],uint32 *u)
3e25c70 import dnscache 1.00
D. J. Bernstein authored Mar 26, 2000
19 {
20 uint32 result;
21
22 result = (unsigned char) s[0];
23 result <<= 8;
24 result += (unsigned char) s[1];
25 result <<= 8;
26 result += (unsigned char) s[2];
27 result <<= 8;
28 result += (unsigned char) s[3];
29
30 *u = result;
31 }
Something went wrong with that request. Please try again.