codex
Loading...
Searching...
No Matches
popcount.h File Reference
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <immintrin.h>
Include dependency graph for popcount.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint32_t u32
 

Functions

u32 popcount0 (u32 n)
 
u32 popcount1 (u32 n)
 
u32 popcount2 (u32 n)
 
u32 popcount3 (u32 n)
 
 __asm__ ("popcount3: popcnt %eax, %edi\n" "ret\n")
 
u32 popcount4 (u32 n)
 
u32 popcount5 (u32 n)
 
u32 popcount6 (u32 n)
 
u32 popcount7 (u32 n)
 
u32 popcount8 (u32 n)
 
 __asm__ ("popcount8:\n" " xor rax, rax\n" ".L0:\n" " shr %edi, 1\n" " jz .L1\n" " adc %eax, 0\n" " jmp .L0\n" ".L1:\n" " adc %eax, 0\n" " ret\n")
 
u32 popcount9 (u32 n)
 
u32 popcount10 (u32 n)
 

Variables

static u32 U32_BIT = sizeof(u32) * CHAR_BIT
 

Typedef Documentation

◆ u32

typedef uint32_t u32

Function Documentation

◆ __asm__() [1/2]

__asm__ ( "popcount3: popcnt % eax,
%edi\n" "ret\n"  )
Here is the caller graph for this function:

◆ __asm__() [2/2]

__asm__ ( "popcount8:\n" " xor rax,
rax\n" ".L0:\n" " shr % edi,
1\n" " jz .L1\n" " adc % eax,
0\n" " jmp .L0\n" ".L1:\n" " adc % eax,
0\n" " ret\n"  )

◆ popcount0()

u32 popcount0 ( u32 n)
Here is the caller graph for this function:

◆ popcount1()

u32 popcount1 ( u32 n)
Here is the caller graph for this function:

◆ popcount10()

u32 popcount10 ( u32 n)
Here is the caller graph for this function:

◆ popcount2()

u32 popcount2 ( u32 n)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ popcount3()

u32 popcount3 ( u32 n)
Here is the caller graph for this function:

◆ popcount4()

u32 popcount4 ( u32 n)
Here is the caller graph for this function:

◆ popcount5()

u32 popcount5 ( u32 n)
Here is the caller graph for this function:

◆ popcount6()

u32 popcount6 ( u32 n)
Here is the caller graph for this function:

◆ popcount7()

u32 popcount7 ( u32 n)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ popcount8()

u32 popcount8 ( u32 n)
Here is the caller graph for this function:

◆ popcount9()

u32 popcount9 ( u32 n)
Here is the caller graph for this function:

Variable Documentation

◆ U32_BIT

u32 U32_BIT = sizeof(u32) * CHAR_BIT
inlinestatic