Home / Forums / Writing a Bitset & Bitmask Helper Class with Fast Intrinsic Operations (POPCNT, CTZ)

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

Writing a Bitset & Bitmask Helper Class with Fast Intrinsic Operations (POPCNT, CTZ)

SigScannerPro
Pattern Scanning & IDA
MEMBER
Rep: 210
Join Date: Jul 2023
Posts: 25
Thanks: 52
2y ago · Jan 19, 2024 10:12 AM
#1
A lightweight compile-time Bitmask class leveraging hardware intrinsics: __popcnt64 (count bits), _BitScanForward64 (find lowest set bit).
SigScannerPro · Pattern scanning & Byte masking
The following users thanked SigScannerPro for this post:
AimbotMath
Trigonometry & Smoothing
MEMBER
Rep: 285
Join Date: Nov 2023
Posts: 27
Thanks: 73
2y ago · Jan 19, 2024 5:00 PM
#2
Bitset operations allow tracking thousands of active game flags in a single 64-bit integer with O(1) bitwise AND/OR/XOR.
AimbotMath · Angular Normalization & Smooth Angles
AsmDisasm
x86_64 Disassembler Dev
MEMBER
Rep: 145
Join Date: Feb 2025
Posts: 23
Thanks: 36
2y ago · Jan 20, 2024 8:00 PM
#3
_mm_popcnt_u64 executes in a single CPU cycle, outperforming software loop bit counting by over 20x.
AsmDisasm · Zydis & Opcode Length Disassembly