refactor(deps): from *.cpp to *.c

This commit is contained in:
luwenpeng
2024-08-29 09:56:57 +08:00
parent ce49357bbc
commit 419d12760e
15 changed files with 32 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
add_library(dablooms dablooms.cpp murmur.cpp)
add_library(dablooms dablooms.c murmur.c)
target_include_directories(dablooms PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(dablooms)
target_link_libraries(dablooms m)
add_subdirectory(test)

View File

@@ -92,50 +92,50 @@ void MurmurHash3_x64_128(const void *key, const int len, const uint32_t seed, vo
{
case 15:
k2 ^= ((uint64_t)tail[14]) << 48;
[[fallthrough]];
/* fallthrough */
case 14:
k2 ^= ((uint64_t)tail[13]) << 40;
[[fallthrough]];
/* fallthrough */
case 13:
k2 ^= ((uint64_t)tail[12]) << 32;
[[fallthrough]];
/* fallthrough */
case 12:
k2 ^= ((uint64_t)tail[11]) << 24;
[[fallthrough]];
/* fallthrough */
case 11:
k2 ^= ((uint64_t)tail[10]) << 16;
[[fallthrough]];
/* fallthrough */
case 10:
k2 ^= ((uint64_t)tail[9]) << 8;
[[fallthrough]];
/* fallthrough */
case 9:
k2 ^= ((uint64_t)tail[8]) << 0;
k2 *= c2;
k2 = ROTL64(k2, 33);
k2 *= c1;
h2 ^= k2;
[[fallthrough]];
/* fallthrough */
case 8:
k1 ^= ((uint64_t)tail[7]) << 56;
[[fallthrough]];
/* fallthrough */
case 7:
k1 ^= ((uint64_t)tail[6]) << 48;
[[fallthrough]];
/* fallthrough */
case 6:
k1 ^= ((uint64_t)tail[5]) << 40;
[[fallthrough]];
/* fallthrough */
case 5:
k1 ^= ((uint64_t)tail[4]) << 32;
[[fallthrough]];
/* fallthrough */
case 4:
k1 ^= ((uint64_t)tail[3]) << 24;
[[fallthrough]];
/* fallthrough */
case 3:
k1 ^= ((uint64_t)tail[2]) << 16;
[[fallthrough]];
/* fallthrough */
case 2:
k1 ^= ((uint64_t)tail[1]) << 8;
[[fallthrough]];
/* fallthrough */
case 1:
k1 ^= ((uint64_t)tail[0]) << 0;
k1 *= c1;

View File

@@ -5,8 +5,17 @@
#ifndef _MURMURHASH3_H_
#define _MURMURHASH3_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out);
#ifdef __cplusplus
}
#endif
#endif // _MURMURHASH3_H_

View File

@@ -1,4 +1,4 @@
add_library(interval_tree STATIC interval_tree.cpp)
add_library(interval_tree STATIC interval_tree.c)
target_include_directories(interval_tree PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(interval_tree PUBLIC ${CMAKE_SOURCE_DIR}/deps/rbtree)
target_link_libraries(interval_tree rbtree)

View File

@@ -12,6 +12,7 @@ extern "C"
{
#endif
#include <stdbool.h>
#include "rbtree_augmented.h"
/*

View File

@@ -1,2 +1,2 @@
add_library(rbtree STATIC rbtree.cpp)
add_library(rbtree STATIC rbtree.c)
target_include_directories(rbtree PUBLIC ${CMAKE_CURRENT_LIST_DIR})

View File

@@ -22,6 +22,7 @@ extern "C"
{
#endif
#include <stdbool.h>
#include <stdlib.h>
struct rb_node

View File

@@ -1,2 +1,2 @@
add_library(timeout STATIC timeout.cpp timeout-bitops.cpp)
add_library(timeout STATIC timeout.c timeout-bitops.c)
target_include_directories(timeout PUBLIC ${CMAKE_CURRENT_LIST_DIR})

View File

@@ -136,7 +136,7 @@
#define WHEEL_MASK (WHEEL_LEN - 1)
#define TIMEOUT_MAX ((TIMEOUT_C(1) << (WHEEL_BIT * WHEEL_NUM)) - 1)
#include "timeout-bitops.cpp"
#include "timeout-bitops.c"
#if WHEEL_BIT == 6
#define ctz(n) ctz64(n)

View File

@@ -1,3 +1,3 @@
add_library(toml toml.cpp)
add_library(toml toml.c)
target_include_directories(toml PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(toml)