flags

flags, function

def const pure flags(...n: number): flagset
def const pure flags(set: flagset, n: number): flagset

Returns a 64-set containing all the integer values provided in n.

Examples

show table "Flags" with
  text(flags(0, 2, 5)) as "Set"
  popCount(flags(0, 2, 5)) as "Count"

Output:

Set Count
{0,2,5} 3

The flags(set, n) overload adds one flag to an existing set:

base = flags(0, 2)
extended = flags(base, 5)

show table "Flags" with
  text(base) as "Base"
  text(extended) as "Extended"
  popCount(extended) as "Count"

Output:

Base Extended Count
{0,2} {0,2,5} 3

When used with const inputs, the overload remains constant and can be used with loop F subset .... See loop for the subset-iteration rules and examples.

Errors

Each value in n must be an integer in the range [0..63].

See also

User Contributed Notes
0 notes + add a note