Well, in Delphi this is true. In FPC it depends on the compiler mode. In modes objfpc and delphi it is the same as longint. In modes fpc, tp, macpas and it is the same as smallint.

But, for all proposed solutions except the table lookup, it doesn't matter wether the integer is 16 or 32 bits.