0

I'm using I/O Trap #4 to read in a number. This gives me a number, however it does not mention if it is read in as signed or unsigned. I would assume this is because it just reads it in as is and it could be either.

How can I check if my value is unsigned? i.e: How can I ensure it was between 0 and 2^32 inclusive?

Vaughan Hilts
  • 2,839
  • 1
  • 20
  • 39

1 Answers1

0

There's no way to "check" this in code; the signedness of a number is not a property that is stored in the register. You have to know how to interpret the bits, i.e. which instructions to use when processing the number since different instructions treat the bits in different ways.

The documentation seems to be ... lacking regarding this. I would recommend simply testing it, what happens if you input -1? You should get 0xffffffff in the register.

unwind
  • 391,730
  • 64
  • 469
  • 606