Difference Between 16- and 32-bit Platforms
|Top Previous Next|
Some Tibbo platforms are of the 16-bit type and some — of the 32-bit type. This difference goes beyond a simple line in the product specification, it affects how Tibbo BASIC and C compilers deal with integer extension.
Everything is simple on 32-bit platforms. All calculations are 32-bit calculations, always. Sure, the result may get truncated to fit in the receiving variable, but internally all calculations are performed using 32-bit registers.
The situation is trickier on 16-bit platforms. By default, all calculations are performed using 16-bit registers. This doesn't affect any 8- and 16-bit calculations. Here is an example:
Now here is the example of calculations that require the use of 32-bit arithmetic:
What happened? Calculating 50000*60000 requires the result to be stored in a 32-bit register, and on 16-bit platforms the compiler defaults to using 16-bit registers.
To make things right, just mix in at least one 32-bit variable. This will tell the compiler to upgrade the calculation to 32 bits: