Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RoaringBitmap/CRoaring
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Sep 19, 2024
2 parents 772f846 + 1931a78 commit cc4fc5b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 35 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/roaring.pc" DESTINATION ${CMAKE_INSTA

add_library(roaring-headers INTERFACE)
target_include_directories(roaring-headers INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/roaring>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCDIR}>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
add_library(roaring-headers-cpp INTERFACE)
target_include_directories(roaring-headers-cpp INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCDIR}>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

####
### Some users want the C++ header files to be installed as well.
Expand All @@ -93,7 +93,7 @@ install(TARGETS roaring-headers roaring-headers-cpp
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCDIR})
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
include(CTest)

##################################
Expand Down
2 changes: 1 addition & 1 deletion include/roaring/roaring64.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef ROARING64_H
#define ROARING64_H

#include <roaring.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#include <roaring/memory.h>
#include <roaring/portability.h>
#include <roaring/roaring.h>
#include <roaring/roaring_types.h>

#ifdef __cplusplus
Expand Down
8 changes: 1 addition & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ if(ROARING_DISABLE_NEON)
target_compile_definitions(roaring PUBLIC DISABLENEON=1)
endif(ROARING_DISABLE_NEON)


target_include_directories(roaring
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(roaring PUBLIC roaring-headers)
target_link_libraries(roaring PUBLIC roaring-headers-cpp)
#
Expand All @@ -75,7 +69,7 @@ install(TARGETS roaring
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(EXPORT roaring-config
FILE roaring-config.cmake
Expand Down
31 changes: 8 additions & 23 deletions src/bitset_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,16 +613,13 @@ size_t bitset_extract_setbits_avx512(const uint64_t *words, size_t length,
for (; (i < length) && (out < safeout); ++i) {
uint64_t w = words[i];
while ((w != 0) && (out < safeout)) {
uint64_t t =
w & (~w + 1); // on x64, should compile to BLSI (careful: the
// Intel compiler seems to fail)
int r =
roaring_trailing_zeroes(w); // on x64, should compile to TZCNT
uint32_t val = r + base;
memcpy(out, &val,
sizeof(uint32_t)); // should be compiled as a MOV on x64
out++;
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand Down Expand Up @@ -667,15 +664,12 @@ size_t bitset_extract_setbits_avx512_uint16(const uint64_t *array,
for (; (i < length) && (out < safeout); ++i) {
uint64_t w = array[i];
while ((w != 0) && (out < safeout)) {
uint64_t t =
w & (~w + 1); // on x64, should compile to BLSI (careful: the
// Intel compiler seems to fail)
int r =
roaring_trailing_zeroes(w); // on x64, should compile to TZCNT
uint32_t val = r + base;
memcpy(out, &val, sizeof(uint16_t));
out++;
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand Down Expand Up @@ -725,16 +719,13 @@ size_t bitset_extract_setbits_avx2(const uint64_t *words, size_t length,
for (; (i < length) && (out < safeout); ++i) {
uint64_t w = words[i];
while ((w != 0) && (out < safeout)) {
uint64_t t =
w & (~w + 1); // on x64, should compile to BLSI (careful: the
// Intel compiler seems to fail)
int r =
roaring_trailing_zeroes(w); // on x64, should compile to TZCNT
uint32_t val = r + base;
memcpy(out, &val,
sizeof(uint32_t)); // should be compiled as a MOV on x64
out++;
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand All @@ -749,16 +740,13 @@ size_t bitset_extract_setbits(const uint64_t *words, size_t length,
for (size_t i = 0; i < length; ++i) {
uint64_t w = words[i];
while (w != 0) {
uint64_t t =
w & (~w + 1); // on x64, should compile to BLSI (careful: the
// Intel compiler seems to fail)
int r =
roaring_trailing_zeroes(w); // on x64, should compile to TZCNT
uint32_t val = r + base;
memcpy(out + outpos, &val,
sizeof(uint32_t)); // should be compiled as a MOV on x64
outpos++;
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand All @@ -772,10 +760,9 @@ size_t bitset_extract_intersection_setbits_uint16(
for (size_t i = 0; i < length; ++i) {
uint64_t w = words1[i] & words2[i];
while (w != 0) {
uint64_t t = w & (~w + 1);
int r = roaring_trailing_zeroes(w);
out[outpos++] = (uint16_t)(r + base);
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand Down Expand Up @@ -836,11 +823,10 @@ size_t bitset_extract_setbits_sse_uint16(const uint64_t *words, size_t length,
for (; (i < length) && (out < safeout); ++i) {
uint64_t w = words[i];
while ((w != 0) && (out < safeout)) {
uint64_t t = w & (~w + 1);
int r = roaring_trailing_zeroes(w);
*out = (uint16_t)(r + base);
out++;
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand All @@ -864,10 +850,9 @@ size_t bitset_extract_setbits_uint16(const uint64_t *words, size_t length,
for (size_t i = 0; i < length; ++i) {
uint64_t w = words[i];
while (w != 0) {
uint64_t t = w & (~w + 1);
int r = roaring_trailing_zeroes(w);
out[outpos++] = (uint16_t)(r + base);
w ^= t;
w &= (w - 1);
}
base += 64;
}
Expand Down Expand Up @@ -1158,4 +1143,4 @@ void bitset_flip_list(uint64_t *words, const uint16_t *list, uint64_t length) {
#endif
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
#endif

0 comments on commit cc4fc5b

Please sign in to comment.