# Difference Between 16- and 32-bit Platforms

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.

## 32-bit platforms

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.

## 16-bit platforms

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:

#### ** Tibbo Basic **

``````dim x,y,z as byte
x=150
y=200
z=(x+y)/10 'the result is 35 (correct), and that's within a single byte's range but intermediary calculations require 16-bit arithmetic
``````

Now here is the example of calculations that require the use of 32-bit arithmetic:

#### ** Tibbo C **

``````unsigned int i,j,k;
i=50000;
j=60000;
k=(i+j)/10; //The result will be 4446, which is incorrect. 32-bit calculations won't be used automatically!
``````

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:

#### ** Tibbo C **

``````unsigned int i,k;
unsigned long d;
i=50000;
d=60000;
k=(i+d)/10; //The result will be 11000. This is correct!
``````