linux/arch/x86/include/asm/arch_hweight.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_HWEIGHT_H
#define _ASM_X86_HWEIGHT_H

#include <asm/cpufeatures.h>

#ifdef CONFIG_64BIT
#define REG_IN
#define REG_OUT
#else
#define REG_IN
#define REG_OUT
#endif

static __always_inline unsigned int __arch_hweight32(unsigned int w)
{}

static inline unsigned int __arch_hweight16(unsigned int w)
{}

static inline unsigned int __arch_hweight8(unsigned int w)
{}

#ifdef CONFIG_X86_32
static inline unsigned long __arch_hweight64(__u64 w)
{
	return  __arch_hweight32((u32)w) +
		__arch_hweight32((u32)(w >> 32));
}
#else
static __always_inline unsigned long __arch_hweight64(__u64 w)
{}
#endif /* CONFIG_X86_32 */

#endif