Compilation fixed on CentOS 7

Bitmap APi changes
This commit is contained in:
Luca Deri
2021-09-27 12:41:40 +02:00
parent 241ee32cbc
commit b9ccff0761
4 changed files with 29 additions and 12 deletions
+8
View File
@@ -1618,9 +1618,17 @@ extern "C" {
void ndpi_bitmap_unset(ndpi_bitmap* b, u_int32_t value);
bool ndpi_bitmap_isset(ndpi_bitmap* b, u_int32_t value);
void ndpi_bitmap_clear(ndpi_bitmap* b);
size_t ndpi_bitmap_serialize(ndpi_bitmap* b, char **buf);
ndpi_bitmap* ndpi_bitmap_deserialize(char *buf);
void ndpi_bitmap_and(ndpi_bitmap* a, ndpi_bitmap* b_and);
void ndpi_bitmap_or(ndpi_bitmap* a, ndpi_bitmap* b_or);
ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(ndpi_bitmap* b);
void ndpi_bitmap_iterator_free(ndpi_bitmap* b);
bool ndpi_bitmap_iterator_next(ndpi_bitmap_iterator* i, uint32_t *value);
/* ******************************* */
#ifdef __cplusplus
+1
View File
@@ -1705,6 +1705,7 @@ typedef int (*ndpi_custom_dga_predict_fctn)(const char* domain, int domain_lengt
/* **************************************** */
typedef void ndpi_bitmap;
typedef void ndpi_bitmap_iterator;
/* **************************************** */
+2 -9
View File
@@ -103,7 +103,7 @@ ndpi_bitmap* ndpi_bitmap_deserialize(char *buf) {
/* ******************************************* */
/* b = b & b_and */
void ndpi_bitmap_and(ndpi_bitmap* b, ndpi_bitmap* b_and) {
void ndpi_bitmap_and(ndpi_bitmap* a, ndpi_bitmap* b_and) {
roaring_bitmap_and_inplace((ndpi_bitmap*)a, (ndpi_bitmap*)b_and);
}
@@ -116,20 +116,13 @@ void ndpi_bitmap_or(ndpi_bitmap* a, ndpi_bitmap* b_or) {
/* ******************************************* */
/* b = b | b_or */
void ndpi_bitmap_or(ndpi_bitmap* a, ndpi_bitmap* b_or) {
roaring_bitmap_or_inplace((ndpi_bitmap*)a, (ndpi_bitmap*)b_or);
}
/* ******************************************* */
ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(ndpi_bitmap* b) {
return(roaring_create_iterator((ndpi_bitmap*)b));
}
/* ******************************************* */
ndpi_bitmap_iterator* ndpi_bitmap_iterator_free(ndpi_bitmap* b) {
void ndpi_bitmap_iterator_free(ndpi_bitmap* b) {
return(roaring_free_uint32_iterator((ndpi_bitmap*)b));
}
+18 -3
View File
@@ -218,6 +218,14 @@ static inline uint32_t croaring_detect_supported_architectures() {
return buffer;
}
#else // defined(__cplusplus) and defined(_MSC_VER) && !defined(__clang__)
#if defined(__GNUC_RH_RELEASE__) && (__GNUC_RH_RELEASE__ != 5)
#define ROARING_DISABLE_AVX
#undef __AVX2__
/* CentOS 7 */
static inline uint32_t croaring_detect_supported_architectures() {
return(dynamic_croaring_detect_supported_architectures());
}
#else
#include <stdatomic.h>
static inline uint32_t croaring_detect_supported_architectures() {
static _Atomic int buffer = CROARING_UNINITIALIZED;
@@ -226,6 +234,7 @@ static inline uint32_t croaring_detect_supported_architectures() {
}
return buffer;
}
#endif // defined(__GNUC_RH_RELEASE__) && (__GNUC_RH_RELEASE__ != 5)
#endif // defined(_MSC_VER) && !defined(__clang__)
#ifdef ROARING_DISABLE_AVX
@@ -315,6 +324,12 @@ extern "C" { // portability definitions are in global scope, not a namespace
#undef CROARING_IS_X64
#endif
#if defined(__GNUC_RH_RELEASE__) && (__GNUC_RH_RELEASE__ != 5 /* RH 8 */)
/* RH 7 don't have atomic includes */
#undef CROARING_IS_X64
#endif
#if defined(__clang_major__) && (__clang_major__<= 8) && !defined(__AVX2__)
// Older versions of clang have a bug affecting us
// https://stackoverflow.com/questions/57228537/how-does-one-use-pragma-clang-attribute-push-with-c-namespaces
@@ -7060,14 +7075,14 @@ static inline void tellmeall() {
(long unsigned int)sizeof(size_t),
(long unsigned int)sizeof(int));
}
#if __LITTLE_ENDIAN__
#ifdef __LITTLE_ENDIAN__
// This is what we expect!
// printf("you have little endian machine");
#endif
#if __BIG_ENDIAN__
#ifdef __BIG_ENDIAN__
printf("you have a big endian machine");
#endif
#if __CHAR_BIT__
#ifdef __CHAR_BIT__
if (__CHAR_BIT__ != 8) printf("on your machine, chars don't have 8bits???");
#endif
}