A set is just a bitmap of the size to hold the number of values in
> Hallo allemaal,
> I building a small computer meant for 6502-computers like the C64 and
> VIC-20. I ran into the following problem. When defining a variable as
> a string, char, record, array etc, the datasize increases with the
> size of thing. But when defining a "set of ...." then the size only
> increases with two. I expected the size to be increased with the
> number of items of the original set.
> So how is a "set of ...." stored?
> Thanks for any answer.
the set. The number of bytes for a set of size n is (n+7) div 8.
Also in Turbo/Borland Pascal the set numbers are limited to
256 (0-255) so the maximum memory requirements is 32 bytes.
I imagine this value can be offset (which I've never done) as in:
SomeSet : set of MinSetValue..MaxSetValue;
Where MaxSetValue - MinSetValue < 256
95% of the time I've used it, was for character checking, e.g.
Vowels: set of char = ['A','E','I','O','U','Y','a','e','i','o','u','y'];
if ch in Vowels then ...