No Clean Feed - Stop Internet Censorship in Australia
«
»

AS3

note to self: use uints wisely

09.09.08 | 1 Comment

I’m laughing at myself ruefully over a silly mistake I just made. I had a variable, of type uint, set to a value that ended up (for obscure reasons) being -1.

Now as the name of the type suggests, uints cannot be negative. So if you try to set them to a value less than zero, it just turns it into a silly arbitrary number (-1, for instance, is 4294967295) that I assume is based on the number of bits available to the memory slot for that value, with the binary digits flipped into ones instead of zeroes.

Incredibly obvious mistake but might be of use to other mathematically-challenged developers like myself.

related

1 Comment

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:

:


«
»
Close
E-mail It