S
seung
Hi,
I'm trying to use uint64_t by #including stdint.h in C on 32-bit
machine. However, I can't seem to get the right value for shifting,
for example:
for(i = 0; i < 64; i++)
{
c = 1 << i;
printf(" %d : %x\n", i, c);
}
gives the following output
0 : 1
1 : 2
2 : 4
3 : 8
4 : 10
5 : 20
6 : 40
7 : 80
8 : 100
9 : 200
10 : 400
11 : 800
12 : 1000
13 : 2000
14 : 4000
15 : 8000
16 : 10000
17 : 20000
18 : 40000
19 : 80000
20 : 100000
21 : 200000
22 : 400000
23 : 800000
24 : 1000000
25 : 2000000
26 : 4000000
27 : 8000000
28 : 10000000
29 : 20000000
30 : 40000000
31 : 80000000
32 : 1
33 : 2
34 : 4
35 : 8
36 : 10
37 : 20
38 : 40
39 : 80
40 : 100
41 : 200
42 : 400
43 : 800
44 : 1000
45 : 2000
46 : 4000
47 : 8000
48 : 10000
49 : 20000
50 : 40000
51 : 80000
52 : 100000
53 : 200000
54 : 400000
55 : 800000
56 : 1000000
57 : 2000000
58 : 4000000
59 : 8000000
60 : 10000000
61 : 20000000
62 : 40000000
63 : 80000000
Anyone know what the problem is, and what the correct solution is for
such use?
Thanks,
-Seung
I'm trying to use uint64_t by #including stdint.h in C on 32-bit
machine. However, I can't seem to get the right value for shifting,
for example:
for(i = 0; i < 64; i++)
{
c = 1 << i;
printf(" %d : %x\n", i, c);
}
gives the following output
0 : 1
1 : 2
2 : 4
3 : 8
4 : 10
5 : 20
6 : 40
7 : 80
8 : 100
9 : 200
10 : 400
11 : 800
12 : 1000
13 : 2000
14 : 4000
15 : 8000
16 : 10000
17 : 20000
18 : 40000
19 : 80000
20 : 100000
21 : 200000
22 : 400000
23 : 800000
24 : 1000000
25 : 2000000
26 : 4000000
27 : 8000000
28 : 10000000
29 : 20000000
30 : 40000000
31 : 80000000
32 : 1
33 : 2
34 : 4
35 : 8
36 : 10
37 : 20
38 : 40
39 : 80
40 : 100
41 : 200
42 : 400
43 : 800
44 : 1000
45 : 2000
46 : 4000
47 : 8000
48 : 10000
49 : 20000
50 : 40000
51 : 80000
52 : 100000
53 : 200000
54 : 400000
55 : 800000
56 : 1000000
57 : 2000000
58 : 4000000
59 : 8000000
60 : 10000000
61 : 20000000
62 : 40000000
63 : 80000000
Anyone know what the problem is, and what the correct solution is for
such use?
Thanks,
-Seung