\begin{itemize}
\item Positional popcount adds up the totals of each bit set to 1 in each bit-position, of an array of input values.
\item Notoriously difficult to do in SIMD assembler: typically 550 lines
+ \item https://github.com/clausecker/pospop
\end{itemize}
\lstinputlisting[language={}]{pospopcount.c}
+
}
/*Copyright (c) 2020 Robert Clausecker fuz@fuz.su
count8 reference implementation */
-func count8safe(counts *[8]int, buf []uint8) {
- for i := range buf
- for j := 0; j < 8; j++
- counts[j] += int(buf[i] >> j & 1)
-}
+count8safe(counts *[8]int, buf []uint8)
+ for i := range buf
+ for j := 0; j < 8; j++
+ counts[j] += int(buf[i] >> j & 1)