1 #ifndef SIMDJSON_LASX_BITMANIPULATION_H
2 #define SIMDJSON_LASX_BITMANIPULATION_H
4 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
5 #include "simdjson/lasx/base.h"
6 #include "simdjson/lasx/intrinsics.h"
7 #include "simdjson/lasx/bitmask.h"
17 SIMDJSON_NO_SANITIZE_UNDEFINED
21 SIMDJSON_NO_SANITIZE_MEMORY
22 simdjson_inline
int trailing_zeroes(uint64_t input_num) {
23 return __builtin_ctzll(input_num);
27 simdjson_inline uint64_t clear_lowest_bit(uint64_t input_num) {
28 return input_num & (input_num-1);
32 simdjson_inline
int leading_zeroes(uint64_t input_num) {
33 return __builtin_clzll(input_num);
37 simdjson_inline
int count_ones(uint64_t input_num) {
38 return __lasx_xvpickve2gr_w(__lasx_xvpcnt_d(__m256i(v4u64{input_num, 0, 0, 0})), 0);
41 simdjson_inline
bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *result) {
42 return __builtin_uaddll_overflow(value1, value2,
43 reinterpret_cast<unsigned long long *
>(result));
The top level simdjson namespace, containing everything the library provides.