BitVecCountPattern
- Function
- August 22, 2025
Table of Contents
BitVecCountPattern
BitVecCountPattern
Description
Count total occurrences of a bit pattern in the bitvector.
Parameters
Name | Direction | Description |
---|---|---|
bv | in | Bitvector to search in |
pattern | in | Pattern to count |
Usage example (from documentation)
u64 count = BitVecCountPattern(&flags, &pattern);
Usage example (Cross-references)
- In
BitVec.c:1441
:
}
u64 BitVecCountPattern(BitVec *bv, BitVec *pattern) {
ValidateBitVec(bv);
ValidateBitVec(pattern);
// BitVecCountPattern tests
bool test_bitvec_count_pattern_basic(void) {
printf("Testing BitVecCountPattern basic functionality\n");
BitVec source = BitVecInit();
BitVecPush(&pattern, true);
u64 count = BitVecCountPattern(&source, &pattern);
result = result && (count == 4);
BitVecPush(&pattern, false);
count = BitVecCountPattern(&source, &pattern);
result = result && (count == 3);
// BitVecCountPattern tests
bool test_bitvec_count_pattern_basic(void) {
printf("Testing BitVecCountPattern basic functionality\n");
BitVec source = BitVecInit();
BitVecPush(&pattern, true);
u64 count = BitVecCountPattern(&source, &pattern);
result = result && (count == 4);
BitVecPush(&pattern, false);
count = BitVecCountPattern(&source, &pattern);
result = result && (count == 3);