Skip to content
Shuai YUAN edited this page Oct 15, 2025 · 4 revisions

Integer Compression

FastPFor

Reverse transformation (prefix sum)

// vectorised Hillis–Steele scan
while (pCurr < pEnd) {
  __m128i a0 = _mm_loadu_si128(pCurr);
  __m128i a1 = _mm_add_epi32(_mm_slli_si128(a0, 8), a0);
  __m128i a2 = _mm_add_epi32(_mm_slli_si128(a1, 4), a1);
  a0 = _mm_add_epi32(a2, runningCount);
  runningCount = _mm_shuffle_epi32(a0, 0xFF);
  _mm_storeu_si128(pCurr++, a0);
}

Table of Contents


Clone this wiki locally