@SMD_3D Interactive
Back in the days of 8 bit processors, it would have been faster to use bytes as this was the base unit. Data was pulled from memory a byte at a time so if you wanted more than a byte it took more operations.
32 Bit systems throw data around in 32 bit lumps - its their base unit. If you only want a byte, it retrieves 4 of them and strips off the 3 you don't want.
Similarly, if you want to do maths on bytes, it converts them to 32 bits, does the work and then converts the result back*.
This is why integer maths in DBPro is so much faster than byte or word maths, it's working in it's natural base.
Sounds crazy I know, but then so did Moores Law, 30 years ago.
* some or all facts used here have been greatly simplified and may not reflect actually processor operation.
@JimHawkins
Strings are a good workaround, but AppGameKit currently only uses 127 bits for characters. I don't know what would happen if you tried to use the rest.
@kamac
In your example the variable "my_boolean_val" is still 32 bit.
With true boolean data types, you would could get 32 times as much in the same space. Of course you do have to use them in batches of 32 to get the full benefit.
Currently the work around is to mask unchecked bits.
Something like this might be used to handle directions;
#constant TRACK_NONE 0
#constant TRACK_UP 1
#constant TRACK_LEFT 2
#constant TRACK_UPLEFT 3
#constant TRACK_DOWN 4
#constant TRACK_UPDOWN 5
#constant TRACK_LEFTDOWN 6
#constant TRACK_UPLEFTDOWN 7
#constant TRACK_RIGHT 8
#constant TRACK_UPRIGHT 9
#constant TRACK_LEFTRIGHT 10
#constant TRACK_UPLEFTRIGHT 11
#constant TRACK_DOWNRIGHT 12
#constant TRACK_UPDOWNRIGHT 13
#constant TRACK_LEFTDOWNRIGHT 14
#constant TRACK_ALL 15
if (location_exits && TRACK_DOWN) > 0
print("there is an exit track downwards")
endif
This stores all the permutations of 4 directions in just 4 bits (one bit per direction).
But even this way only 1/8th of the variable is being used.
EDIT: replies and clarity