Bitshifting or Dividing on an array?
Posted: Mon May 05, 2003 9:30 pm
Hi,
I seem to be having another problem
I have declared an array:
Dim StorageArray.b(320,240,3)
And I add a value to it:
StorageArray(1,1,1) = 255
Now, when I try and divide or bitshift that value, and write it to a file, I still end up with 0xFF (255):
WriteByte(StorageArray(1,1,1)>>3)
and:
WriteByte(StorageArray(1,1,1)/8)
Can anyone see what I am doing wrong?
I am sure it is something really obvious, I just can't see it...
Many Thanks,
Toris
[EDIT]
This odd thing is, that the following line works... :
WriteByte(255>>8)
It writes the correct value of 0x1F (31)...
[/EDIT]
I seem to be having another problem
I have declared an array:
Dim StorageArray.b(320,240,3)
And I add a value to it:
StorageArray(1,1,1) = 255
Now, when I try and divide or bitshift that value, and write it to a file, I still end up with 0xFF (255):
WriteByte(StorageArray(1,1,1)>>3)
and:
WriteByte(StorageArray(1,1,1)/8)
Can anyone see what I am doing wrong?
I am sure it is something really obvious, I just can't see it...
Many Thanks,
Toris
[EDIT]
This odd thing is, that the following line works... :
WriteByte(255>>8)
It writes the correct value of 0x1F (31)...
[/EDIT]