Number,int,uint not working correctly 0.71

Bug #1119626 reported by zahurdias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Lightspark
Confirmed
Medium
Unassigned

Bug Description

   trace("test 1")
   trace( getQualifiedClassName(int.MAX_VALUE) ) //Number
   trace( getQualifiedClassName(uint.MAX_VALUE) ) //Number
   trace( getQualifiedClassName(Number.MAX_VALUE) ) //Number

   trace("test 2")
   trace( getQualifiedClassName(int.MAX_VALUE>>1) ) //Number
   trace( getQualifiedClassName(uint.MAX_VALUE>>1) ) //int
   trace( getQualifiedClassName(Number.MAX_VALUE>>1) ) //int

   trace("test 3")
   trace( getQualifiedClassName(int.MAX_VALUE>>>1) ) //Number
   trace( getQualifiedClassName(uint.MAX_VALUE>>>1) ) //Number
   trace( getQualifiedClassName(Number.MAX_VALUE>>>1) ) //int

   trace("test 4")
   trace( getQualifiedClassName(int.MIN_VALUE-1) ) //Number
   trace( getQualifiedClassName(uint.MIN_VALUE-1) ) //int
   trace( getQualifiedClassName(Number.MIN_VALUE-1) ) //int

Revision history for this message
Antti Ajanki (aajanki) wrote :

Does somebody know when getQualifiedClassName returns Number and when int?

Changed in lightspark:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
zahurdias (zahurdias) wrote :

don't know if this helps:

     The AS3 VM uses 32-bit Atom formats to store various types. 3-bits of the Atom describe the type data, leaving 29-bits for actual data. In some cases, like null/undefined/void/etc, we use 3-bits plus a few more bits to define the type.

    For signed integers, we have 28-bits to work with plus a sign bit. For unsigned integers we have 29-bits (or maybe 28 with the upper bit always zero?). Once your number gets larger than 28/29 bits, we dynamically switch it to a Number Atom type, which contains a 3-bit type value with a 29-bit ptr. All ptrs are 8-BYTE aligned so we get away with using 29-bits there.

    All three formats are basically interchangeable. When storing a number in an Atom, we see if it’s an integer and fits within the 28/29 bits. If so, we store it as a int/uint value – otherwise we store it as a Number value.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.