Question

I have an AIR application that reads RFID tags. The values of the tag ID's are 7 byte hex values.

There is a limitation on the highest numbers represented accurately within actionscript. The Number type only works with 53 bit values. The 7byte hex value is 56 bit.

So there is a chance of possibly duplicate keys.

Is there any advantage in using the HEX values themselves as keys for the dictionary?

Or does Flash internally still convert these values to Numbers before using as keys?

Was it helpful?

Solution

You are right about this limitation, as3 Number type is actually a Double precision 64-bit with only 53 bits for the mantissa, but I wonder how do you read the 7 byte value and where do you store it?

There are several as3 Long implementations (64 Integer) so you can use it to read and store 7 bit number (but it will still read 8 bytes from the ByteArray), but if you don't need the Math for your big number just use Strings to read in and use them as a keys for Dictionary.

Anyway Dictionary uses only Strings or Objects as a keys but not Numbers, so even if as3 had a Long it would be convert to the String.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top