Make small fixes and oops ran clang-format on dtoa
This commit is contained in:
24
libc/bits/popcnt.h
Normal file
24
libc/bits/popcnt.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef COSMOPOLITAN_LIBC_BITS_POPCNT_H_
|
||||
#define COSMOPOLITAN_LIBC_BITS_POPCNT_H_
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
unsigned long popcnt(unsigned long) pureconst;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#define popcnt(X) \
|
||||
(isconstant(X) ? __builtin_popcount(X) : ({ \
|
||||
unsigned long Res, Pop = (X); \
|
||||
if (X86_HAVE(POPCNT)) { \
|
||||
asm("popcnt\t%1,%0" : "=r"(Res) : "r"(Pop) : "cc"); \
|
||||
} else { \
|
||||
Res = (popcnt)(Pop); \
|
||||
} \
|
||||
Res; \
|
||||
}))
|
||||
#endif /* GNUC && !ANSI */
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_BITS_POPCNT_H_ */
|
||||
Reference in New Issue
Block a user