Max Integer Value

BlitzPlus Forums/BlitzPlus Beginners Area/Max Integer Value

BlackD(Posted 2004) [#1]
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


WolRon(Posted 2004) [#2]
INT's are also negative.

-2147483648 to +2147483647


soja(Posted 2004) [#3]
Actually, -2147483648 to +2147483647. =)


WolRon(Posted 2004) [#4]
That's what I said! ;)


soja(Posted 2004) [#5]
I better get my eyes checked ;)


aab(Posted 2004) [#6]
lol..
Our high school computing teacher messed that one up, only on a much easier scale:
eg:
-127 to +128 for a negative byte: NOOOO!

she also wrote 1000 000 as being negative 1 as out first example for two's complement as well.

The subjects ridiculus, and its not taught any better.
does BlitzMax have the option for +ve ints?


SpiritWnd(Posted 2004) [#7]
Joy, and no way to unsign either...looks like it is time to take some of the skill you learned in Blitz and read a C++ manual. You will find they are practically cousins.

Spirit


VIP3R(Posted 2004) [#8]

does BlitzMax have the option for +ve ints?


BlitzMax caters for 64bit (Long) integers and (Double) floats:

32 bit signed integer (Int): -2^31 to +2^31-1
64 bit signed integer (Long): -2^63 to +2^63-1

So you could feasibly have 32bit unsigned integers by converting to positive 64bit long integers.


Mikorians(Posted 2014) [#9]
I know, dead post, just for noobs FYI

You can too hold $ffffffff in an int!
Use a bank and two shorts if you're uncertain
that the int or function you're using will convert
the number right for your application.
The bank lets you get correct 32 bit numbers
for examination.
Ints holding bank-correct values will write to
a binary disk file correctly - I checked!
You can use both writeint and readint without
any trouble at all!