Intrinsics

The Intrinsics API provides direct CPU intrinsic bindings for faithful reproduction of pointer decryption and obfuscation logic (bit rotations, bit scans, and a subset of SSE integer operations).

Important Notes

  • All SSE 128-bit operations use array<uint8> length = 16.

  • Outputs are written to &out result arrays.

  • For mm_extract_*, lane index must be in range (ex: mm_extract_epi640..1, mm_extract_epi320..3, mm_extract_epi160..7, mm_extract_epi80..15).

  • For mm_shuffle_epi8 (pshufb): mask high bit (0x80) zeros the output byte (hardware behavior).


Bit Rotation

uint8  rol8 (uint8  value, int count)
uint8  ror8 (uint8  value, int count)
uint16 rol16(uint16 value, int count)
uint16 ror16(uint16 value, int count)
uint32 rol32(uint32 value, int count)
uint32 ror32(uint32 value, int count)
uint64 rol64(uint64 value, int count)
uint64 ror64(uint64 value, int count)

Rotates bits left/right by count (wrap-around).


Byte Swap

Swaps endianness of the value.


Bit Manipulation

  • popcnt* — population count (# of set bits)

  • lzcnt* — leading zero count

  • tzcnt* — trailing zero count


SSE Logical Operations (128-bit)

All operands are 16-byte arrays.

  • mm_andnot_si128(a, b) behaves like (~a) & b.


SSE Shift Operations


SSE Shuffle Operations


SSE Unpack Operations


SSE Arithmetic


SSE Set / Broadcast

Lane ordering note (matches your tests): mm_set_epi32(e3,e2,e1,e0)mm_extract_epi32(result, 0) == e0, ..., index 3 == e3.


SSE Extract


SSE Compare

Outputs per lane are 0xFF..FF for equal, 0 for not equal (hardware behavior).


Full Test Example

Last updated