setPattern()
Sets a bit32/bit64 variable to a binary pattern.
Synopsis
int setPattern(bit32 &aBitVar, string pattern);
int setPattern(bit64 &aBitVar, string pattern);
Parameters
Parameter | Description |
---|---|
aBitVar | Variable to be modified |
pattern | Pattern |
Return value
0, in the event of an error -1.
Errors
Missing/incorrect arguments.
Description
Sets aBitVar with the pattern pattern. Strings that are shorter than 32 bit / 64 bit are padded with "0". Interpretation of the pattern string:
Pattern | Comment |
---|---|
0 | aBitVar must contain 0 at the appropriate position |
1 | aBitVar must contain 1 at the appropriate position |
all other characters | aBitVar is not modified at the appropriate position |
Example
main()
{
bit32 b;
setPattern(b, "1111");
setPattern(b, "xx0x");
DebugN(checkPattern(b, "1101")); // Returns 1
}
Assignment
Availability
CTRL