How should I represent 16 bits of data in SmileBASIC? Do I use ASCII or an array? If I had a value lower than 256 in an array slot, would it count as 8 bits or inflate? Same with having either a 0 or 1 in an array slot. Will this count as only one bit? (I'm trying to make my files as tiny as possible. You'll see why soon. ;] )
16 Bits
Root / Programming Questions / [.]
h267Created:
Integer variables are always 32 bits, and characters in strings are always 16 (except they can be between 8 and 24 bits when saved)
Strings are way too slow to store data efficiently, though.
You could store two 16 bit values in an integer by doing something like:
INTEGER=V1 OR (V2<<16) V1=INTEGER AND &HFFFF V2=INTEGER>>16
12Me21's code will have the odd property of extending the 'sign' bit of the V2 value, but not the V1 value, when they are 'extracted' from INTEGER.