Different var sizes?

BlitzPlus Forums/BlitzPlus Programming/Different var sizes?

Stamm(Posted 2010) [#1]
I didn't really know where to post this, so I place it here, hoping someone in the Blitz Research Team will find it.
So what I'd like very much to have would be more differenciated types of variables, especially inetegers, because for now there are only what you'd call an "unsigned QWord", e.g. a bit pattern representing any integer between -2**16 and 2**16-1: a 31 bit integer with one sign bit
Whaz I actually want to say is that, for purposes of better memory use, it should be possible to use DIFFERENT sizes for that, e.g.:
1Byte, unsigned: value=0 to 255
2byte, unsigned(DWord=Short): value=0 to 65535
4byte, unsigned(QWord=Integer): value=0 to 4 294 967 295(=2**32-1)
4byte,signed: value=-2 147 483 648(=-2**16) to 2 147 483 647 (=2**16-1)
Note that this is the only format uually supported by blitz
any length(plain integer),signed: this is useful for values that tend to + or -infinity, which appear in some mathematical functions
also, a system like this for floats:
4byte,signed(Float): this is currently the only one in use
any length,signed:same reaso to use as for the plain(or long) integer
To make things easier for new programmers, it could be implemented with a standard format of 4byte signed integer or 4byte signed float so you don't necessarily have to define tha format
I know this wouldn't be fast to implement but I and, I'm sure, many others could use it very much.


xlsior(Posted 2010) [#2]
There's also a 1 byte unsigned variable already: BYTE


Stamm(Posted 2010) [#3]
really? how do you make it?
you cant say b=byte(12) no?
or is it something like b.byte=12?
or are you just talking of 1-byte values in files or banks?


Stamm(Posted 2010) [#4]
hint to the research team: you could implement it as in C, so that you'd get sthg like
unsigned long long int TEST
TEST=Rand(0,2^(8*16))
print TEST