Ticket #8 (closed defect: fixed)
Int truncated to 30 bits on 32-bit systems -- sometimes, at least
| Reported by: | SamB | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | backend | Version: | |
| Keywords: | Cc: | ||
| Test Case: | bugs/IntEnum |
Description
When running the test bugs/IntEnum, instead of:
[16777215,33554431,50331647,67108863,83886079,100663295,117440511,134217727,150994943,167772159, 184549375,201326591,218103807,234881023,251658239,268435455,285212671,301989887,318767103, 335544319,352321535,369098751,385875967,402653183,419430399,436207615,452984831,469762047, 486539263,503316479,520093695,536870911,553648127,570425343,587202559,603979775,620756991, 637534207,654311423,671088639,687865855,704643071,721420287,738197503,754974719,771751935, 788529151,805306367,822083583,838860799,855638015,872415231,889192447,905969663,922746879, 939524095,956301311,973078527,989855743,1006632959,1023410175,1040187391,1056964607,1073741823, 1090519039,1107296255,1124073471,1140850687,1157627903,1174405119,1191182335,1207959551, 1224736767,1241513983,1258291199,1275068415,1291845631,1308622847,1325400063,1342177279, 1358954495,1375731711,1392508927,1409286143,1426063359,1442840575,1459617791,1476395007, 1493172223,1509949439,1526726655,1543503871,1560281087,1577058303,1593835519,1610612735, 1627389951,1644167167,1660944383,1677721599,1694498815,1711276031,1728053247,1744830463, 1761607679,1778384895,1795162111,1811939327,1828716543,1845493759,1862270975,1879048191, 1895825407,1912602623,1929379839,1946157055,1962934271,1979711487,1996488703,2013265919, 2030043135,2046820351,2063597567,2080374783,2097151999,2113929215,2130706431,2147483647]
I get:
[16777215,33554431,50331647,67108863,83886079,100663295,117440511,134217727,150994943,167772159, 184549375,201326591,218103807,234881023,251658239,268435455,285212671,301989887,318767103, 335544319,352321535,369098751,385875967,402653183,419430399,436207615,452984831,469762047, 486539263,503316479,520093695,536870911,-520093697,-503316481,-486539265,-469762049,-452984833, -436207617,-419430401,-402653185,-385875969,-369098753,-352321537,-335544321,-318767105, -301989889,-285212673,-268435457,-251658241,-234881025,-218103809,-201326593,-184549377, -167772161,-150994945,-134217729,-117440513,-100663297,-83886081,-67108865,-50331649,-33554433, -16777217,-1,16777215,33554431,50331647,67108863,83886079,100663295,117440511,134217727, 150994943,167772159,184549375,201326591,218103807,234881023,251658239,268435455,285212671, 301989887,318767103,335544319,352321535,369098751,385875967,402653183,419430399,436207615, 452984831,469762047,486539263,503316479,520093695,536870911,-520093697,-503316481,-486539265, -469762049,-452984833,-436207617,-419430401,-402653185,-385875969,-369098753,-352321537, -335544321,-318767105,-301989889,-285212673,-268435457,-251658241,-234881025,-218103809, -201326593,-184549377,-167772161,-150994945,-134217729,-117440513,-100663297,-83886081, -67108865,-50331649,-33554433,-16777217,-1,16777215,33554431,50331647,67108863,83886079, 100663295,117440511,134217727,150994943,167772159,184549375,201326591,218103807,234881023, 251658239,268435455,285212671,301989887,318767103,335544319,352321535,369098751,385875967, 402653183,419430399,436207615,452984831,469762047,486539263,503316479,520093695,536870911, -520093697,-503316481,-486539265,-469762049,-452984833,-436207617,-419430401,-402653185, -385875969,-369098753,-352321537,-335544321,-318767105,-301989889,-285212673,-268435457, -251658241,-234881025,-218103809,-201326593,-184549377,-167772161,-150994945,-134217729, -117440513,-100663297,-83886081,-67108865,-50331649,-33554433,-16777217,-1,16777215,33554431, 50331647,67108863,83886079,100663295,117440511,134217727,150994943,167772159,184549375,201326591, 218103807,234881023,251658239,268435455,285212671,301989887,318767103,335544319,352321535, 369098751,385875967,402653183,419430399,436207615,452984831,469762047,486539263,503316479, 520093695,536870911,-520093697,-503316481,-486539265,-469762049,-452984833,-436207617,-419430401, -402653185,-385875969,-369098753,-352321537,-335544321,-318767105,-301989889,-285212673, -268435457,-251658241,-234881025,-218103809,-201326593,-184549377,-167772161,-150994945, -134217729,-117440513,-100663297,-83886081,-67108865,-50331649,-33554433,-16777217,-1,16777215]
Notice how the numbers wrap around again and again. Running the numbers at the crossover through the handy calculator Python, I get:
>>> map(hex,[536870911,-520093697]) ['0x1fffffff', '-0x1f000001']
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](/lhc/chrome/site/your_project_logo.png)