Saturday, February 23, 2013

Understanding the difference between 16 bit and 32 bit devices

Most modern computers are have 32bit (or 64 bit) instruction sets that allow them to handle an equal size of data. Running the saya app on a Nokia e71(being a smartphone) worked because the OMAP processor is a true 32-bit instruction set architecture. So it was a bit of a quandary that it didn't work on the lesser s40 devices.

I tracked down the issue to this line
number_field = new TextField("Phone Number", "233200238442", 12, TextField.NUMERIC);
S40 devices are built on a 16-bit RISC architecture which defines the biggest integer as
65535 is a frequently occurring number in the field of computing because it is thehighest number which can be represented by an unsigned 16 bit binary ... http://en.wikipedia.org/wiki/65535_(number)
 As you can well see 233200238442 is integrally bigger than 65535. The illegal exception thrown is as a result of this last part of the statement "TextField.NUMERIC" which defines the contents of the textfield as a numeric value that will ultimately cause a conflict with what size the internal registers can hold.

The simple solution therefore was to change it to "TextField.PHONENUMBER"

1 comment: