Max Integer Value

Blitz3D Forums/Blitz3D Beginners Area/Max Integer Value

BlackD(Posted 2004) [#1]
(I can see cross-posting to get replies for help becoming common, unless at least beginner forums are opened up to registered users of any product)

Why is the max integer value in Blitz, 2147483647 - FF FF FF 7F?
Why not the actual maximum, 4294967295 - FF FF FF FF?

I'm writing a utility which does massive file writing, but of course - Blitz has slow disk access. So, to speed it up, I tried writing INTs instead of BYTEs, in groups of 4. And yes, this does speed it up by a factor of 4, but it means half the INTs I can't store - let alone write. For instance, to write AA AA AA AA, you need the INT value of 2863311530 - too high for Blitz. :\

Is there a workaround for storing large INTs?

+BlackD


Genexi2(Posted 2004) [#2]
Why is the max integer value in Blitz, 2147483647 - FF FF FF 7F?



I believe thats because Blitz uses Signed Integers, which range from -2147483647 to 2147483647.

Subtracting 2147483647 from each of your values might do the trick...not exactly sure here.


DJWoodgate(Posted 2004) [#3]
How were you writing the bytes, using writebyte() or writebytes()? I would have thought Writebytes() would be a lot faster, though I have not tested it.


BlackD(Posted 2004) [#4]
Well, wrote a work-around, but it's not what I like.

For each value over 2147483647, store another value INDICATING it's over 2147483647. Then, rather than storing the full value in the INT, store just the remainder of the value less 2147483647.

Then, when writing out the data, write 2147483647 + the value + 1. Messy. :(


Floyd(Posted 2004) [#5]
I think you are imagining a problem which does not exist.

Whether an integer is signed or unsigned is a matter of interpretation. The actual bits are unchanged.

For example, if you set n to the hex value FFFFFFFF Blitz will display it as -1. But if you WriteInt n to a file it will be 32 1-bits, the same as the unsigned integer 4294967295.


BlackD(Posted 2004) [#6]
Thanks Floyd. :)