std-bitlist


Synopsis

(std-bitlist <flag>)

Description

std-bitlist returns a list of all set bitvalues in flag.

It used to get all settings in a flag, which is used to store independent logical values in a single integer number. It uses bit values and not bit positions because the online help for flags uses bit values too, such as the initget flag: 1,2,4,8,16,32,64,128

Example

(std-bitlist 129)  => (1 128)

It is similar to the function (std-num->bin) which converts a number to a "bitvector", a list all set bits, but not bitvalues. The sum of all bitvalues (std-bitlist) makes the flag.

(= (apply '+ (std-bitlist flag)) flag) => T

Arguments

flag: A integer number representing a flag, a logical sum of bitvalues.

Return Value

A list of integer numbers, all bitvalues which make the flag.

Side Effects

None.

Module

(std-require 'STDMATH)

Defined in STDMATH