Prev | Current Page 87 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

As the Int is
also only 32 bits, you can store both data types in exactly the same fashion, but determine the differences
Chapter 3: Learning the Basics
33
between them by setting the most significant bit for all Int values to 1 . This way, you have all the speed
of a raw integer while maintaining a uniform type differentiation system.
As Neko uses the 31st bit of its integer values as the signed bit, you should ideally provide support for
this limitation across all three of the supported platforms where code may be interchangeable between
each platform. Therefore, when you use Int s in haXe, always make sure the value you are representing
will not exceed the 31 - bit limit. If you are unsure, however, then use a Float instead, which can contain
far greater values.
Which Number Type?
You have touched on some pretty complex concepts while describing the Int and Float types.
However, if you have no idea what has just been discussed and all this talk of bits and pointers has
flown way over your head, it will probably help to provide a small summary.


Pages:
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99