Page 1 of 1

Posted: Sun Feb 02, 2003 1:56 am
by BackupUser
Restored from previous forum. Originally posted by vanleth.

Is it possible to have unsigned Byte variables? So you can store numbers for a palette. This would also be handy when parsing encoded data ect. Or should I just use a word varible for bigger numbers.

The below example is just a byte varible test.

Code: Select all

Restore bytetest
For a = 0 To 2
  Read test.b
  Debug test
Next

DataSection
bytetest:
Data.b 255,0,128
EndDataSection

Best regards
Van

Posted: Sun Feb 02, 2003 2:48 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Data is Data. Memory is Memory. Bytes are Bytes. Octets are Octets. Bits are Bits.

None of the above knows 'signed' or 'unsigned'.
Signed is your (and PB´s internal) interpretation,
but if you look at it in a different way, its unsigned.

Str() displays signed interpretation of a number.
StrU() displays unsigned interpretation of the same number.

Is %11111111 in an Octet '255' or '-1' ??
Yes, its the same - depends how you interpret it... :)

Code: Select all

Restore bytetestFor a = 0 To 2
  Read test.b
  Debug StrU(test,#BYTE)
Next

DataSection
  bytetest:
    Data.b 255,0,128
EndDataSection
cya,
...Danilo
(registered PureBasic user)

Posted: Sun Feb 02, 2003 11:11 am
by BackupUser
Restored from previous forum. Originally posted by vanleth.

Thanks Danilo, think I over looked the StrU() command.

Van