1 #ifndef SIMDJSON_ICELAKE_BITMANIPULATION_H
2 #define SIMDJSON_ICELAKE_BITMANIPULATION_H
4 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
5 #include "simdjson/icelake/base.h"
6 #include "simdjson/icelake/intrinsics.h"
16 SIMDJSON_NO_SANITIZE_UNDEFINED
20 SIMDJSON_NO_SANITIZE_MEMORY
21 simdjson_inline
int trailing_zeroes(uint64_t input_num) {
22 #if SIMDJSON_REGULAR_VISUAL_STUDIO
23 return (
int)_tzcnt_u64(input_num);
30 return __builtin_ctzll(input_num);
35 simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) {
36 return _blsr_u64(input_num);
40 simdjson_inline
int leading_zeroes(uint64_t input_num) {
41 return int(_lzcnt_u64(input_num));
44 #if SIMDJSON_REGULAR_VISUAL_STUDIO
45 simdjson_inline
unsigned __int64 count_ones(uint64_t input_num) {
47 return __popcnt64(input_num);
50 simdjson_inline
long long int count_ones(uint64_t input_num) {
51 return _popcnt64(input_num);
55 simdjson_inline
bool add_overflow(uint64_t value1, uint64_t value2,
57 #if SIMDJSON_REGULAR_VISUAL_STUDIO
58 return _addcarry_u64(0, value1, value2,
59 reinterpret_cast<unsigned __int64 *
>(result));
61 return __builtin_uaddll_overflow(value1, value2,
62 reinterpret_cast<unsigned long long *
>(result));
The top level simdjson namespace, containing everything the library provides.