J
James Harris
1. Is there a type for a double-width integer (or a simple way to derive one)?
I mean that if ints are N bytes then an integer of 2N bytes should be generated.
I am writing code that I want to compile to 16-, 32- and 64-bit architectures. On each of them the int will be the correct size but I was also looking for a way to define a double-width integer that would be twice as wide as an int.
If I use type "long" my 16-bit C compiler generates a 32-bit integer but gcc requires "long long" to generate the 64-bit integer that is required on a 32-bit target. The 16-bit compiler doesn't recognise "long long".
2. Even better than simply doubling the width in all cases is there a clean and portable way to do the following:
For a 16-bit target generate a 32-bit integer.
For a 32-bit or 64-bit target generate a 64-bit integer.
Finally, what names would you use for the resulting wide integer types?
James
I mean that if ints are N bytes then an integer of 2N bytes should be generated.
I am writing code that I want to compile to 16-, 32- and 64-bit architectures. On each of them the int will be the correct size but I was also looking for a way to define a double-width integer that would be twice as wide as an int.
If I use type "long" my 16-bit C compiler generates a 32-bit integer but gcc requires "long long" to generate the 64-bit integer that is required on a 32-bit target. The 16-bit compiler doesn't recognise "long long".
2. Even better than simply doubling the width in all cases is there a clean and portable way to do the following:
For a 16-bit target generate a 32-bit integer.
For a 32-bit or 64-bit target generate a 64-bit integer.
Finally, what names would you use for the resulting wide integer types?
James