I read that GCC supports the long long int type which is required to be at least 64 bits wide. But how can it make math operations with it on a CPU that is only 32 bits wide?
I read that GCC supports the long long int type which is required to
Share
The compiler will synthesize math operations (or use function calls) that use more than one CPU instruction to perform the operation. For example, an add operation will add the low order components (the low words) of the
long longvalues and will then take the carry out of that operation and feed it into an add operation on the high order words of thelong long.So the following C code:
might be represented by an instruction sequence that looks something like:
And if you consider for a moment, compilers for 8 and 16 bits systems had to do this type of thing for 16 and/or 32-bit values long before
long longcame into being.