I wanted to check the sizes of different ttmath::Int's on x86_64 Linux machine and for that I wrote following code:
typedef ttmath::Int<2> TTInt;
int main (void)
printf ("TTInt = %d\n", (int) sizeof (TTInt));
printf ("int = %d\n", (int) sizeof (int));
printf ("int64_t = %d\n", (int) sizeof (int64_t));
printf ("uint64_t = %d\n", (int) sizeof (uint64_t));
The output of this is:
TTInt = 16
int = 4
int64_t = 8
uint64_t = 8
This output is confusing to me, because as per my understanding 2+2 are not adding up to 4. Since "int" is 4bytes, I expected TTInt to be 2*4=8 bytes. However it is reported as 16 bytes.
I checked the ttmath source, but didn't find any obvious answer for it. So what could be the error I am making in interpreting this?
On x86_64 ttmath::Int<2> takes two 64 bit words and the sizeof from it is 16.
I found that answer. I overlooked ttmathtypes.h file. This thread can be closed.