Cool 3dsmax bug when casting a string to integer64

Spent an hour figuring out why some mesh properties turned out wrong after we optimized some property bits (we’re storing shader “property” features as bits in a single INT32).

Type this in 3dsmax’s listener:
“2147483655” as integer64

and what do you get back? (L just means the number is “LONG”)
2147483648L

E.g, this DOES work:
i = 2147483648L
iLarge = i * 4
the value of iLarge is 8589934592L

SamiV. (I swear to never ever again try to just quickly make some utility in MaxScript while I could do it for real in Python… :)Python now…)

Same issue here… did you find a work-around / fix for this?

It’s been a while, but I’m pretty sure I came up with some workaround since I got the thing running…

Perhaps I just truncated the string into two byte segments and rebuilt the int64 manually with powers of two? Can’t recall anymore, sorry. I can dig into our Perforce history around the time I made the post if you need this and the thing is still borked in 2012.

SamiV.

other options:

ru = stringstream “2147483655L”
readValue ru
–2147483655L

“2147483655L” as integer64

Ah thanks Ruramuq! Your workaround is much nicer than mine. :slight_smile:

Samiv.