# ForEachSetBitInBitMask
Grammar — For Each var|Bit in bitMask do (Actions)
Flags —SubFunctions
|Action
Executes a For Loop using an integer value. This will run the action set included under the For Each Bit In BitMask for every bit in mask.
# Arguments
anyvariable
— Integer Variablebitmask
— BitMask
Returns — void
#AUTOVAR(g, bitmask) = #PARAM(bitMask);
#AUTOVAR(p) = 0;
#AUTOVAR(bitsFound) = 0;
#AUTOVAR(q) = BitMaskCountOnBits(#AUTOVAR(g));
if (#AUTOVAR(q) != 0) {
while (#AUTOVAR(bitsFound) != #AUTOVAR(q)) {
if (BitMaskTrueIndex(#AUTOVAR(g), #AUTOVAR(p))) {
#AUTOVAR(bitsFound) += 1;
#PARAM(var) = #AUTOVAR(p);
#SUBFUNCS(Actions)
}
#AUTOVAR(p) += 1;
}
}
# Related
Category: BitMask / Loops
- ForEachSetBitInBitMask — macro
- ForEachUnSetBitInBitMask — macro
# Examples
— None found —