#1 2015-06-03 11:00:00

Starkis
Member
From: Up in the space
Registered: 2011-01-16
Posts: 27

checking sets

wonder, how element check in a set is implemented? is it performance wise/optimized? or switch use is a preferred way?

var
    _set : set of byte; //has for example 20 elements
begin
   if value in _set
      then ...


--- we no need no water, let the ... burn ---

Offline

#2 2015-06-03 14:46:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,548
Website

Re: checking sets

you could write

var _set: set of 0..19;

If you know that there is up to 20 items.
It would minimize the _set memory use to the minimum.

AFAIR maximum set size is of 256 items.

Offline

Board footer

Powered by FluxBB