PS. Did you try this test program to check the size of the unsigned long?

> 
> 
> The c standard for long states that it can be 32-bits or more! So to check 
> what happens on my 64-bit test machine:
> 
> #include <stdio.h>
> #include <limits.h>
> #include <stdint.h>
> 
> int main(void){
>     printf("sizeof(int) = %d\n", (int)sizeof(int));
>     printf("sizeof(long) = %d\n", (int)sizeof(long));
>     printf("sizeof(unsigned long) = %d\n", (int)sizeof(unsigned long));
>     printf("sizeof(uint32_t) = %d\n", (int)sizeof(uint32_t));
>     printf("sizeof(double) = %d\n", (int)sizeof(double));
>     unsigned long value = 1;
>     for (int i = 1; i <= 8 * (int)sizeof(unsigned long); i++) {
>         printf("[%d] %lu = %u\n", i, value, (uint32_t) value);
>       value = (value << 1);
>     }
>     return 0;
> }
> 
> > gcc test.c && ./a.out
> 
> sizeof(int) = 4
> sizeof(long) = 8
> sizeof(unsigned long) = 8
> sizeof(uint32_t) = 4
> sizeof(double) = 8
> …
> [31] 1073741824 = 1073741824
> [32] 2147483648 = 2147483648
> [33] 4294967296 = 0
> [34] 8589934592 = 0
> …
> 
> 


Reply via email to