1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
typedef unsigned long long ULL;
ULL back;
ULL hpart, lpart;
ULL
build(long h, long l)
{
hpart = h;
hpart <<= 32;
lpart = l;
lpart &= 0xFFFFFFFFLL;
back = hpart | lpart;
return back;
}
main()
{
if (build(0, 1) != 0x0000000000000001LL)
abort();
if (build(0, 0) != 0x0000000000000000LL)
abort();
if (build(0, 0xFFFFFFFF) != 0x00000000FFFFFFFFLL)
abort();
if (build(0, 0xFFFFFFFE) != 0x00000000FFFFFFFELL)
abort();
if (build(1, 1) != 0x0000000100000001LL)
abort();
if (build(1, 0) != 0x0000000100000000LL)
abort();
if (build(1, 0xFFFFFFFF) != 0x00000001FFFFFFFFLL)
abort();
if (build(1, 0xFFFFFFFE) != 0x00000001FFFFFFFELL)
abort();
if (build(0xFFFFFFFF, 1) != 0xFFFFFFFF00000001LL)
abort();
if (build(0xFFFFFFFF, 0) != 0xFFFFFFFF00000000LL)
abort();
if (build(0xFFFFFFFF, 0xFFFFFFFF) != 0xFFFFFFFFFFFFFFFFLL)
abort();
if (build(0xFFFFFFFF, 0xFFFFFFFE) != 0xFFFFFFFFFFFFFFFELL)
abort();
exit(0);
}
|