This commit is contained in:
Timerix22 2022-07-21 01:18:38 +03:00
parent 84c3a10035
commit 7cd2facc5e
3 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@
#include "../HashFunctions/hash.h"
#include "../Autoarr2/Autoarr2.hpp"
#include <functional>
// amount of rows
typedef uint32 HT_HEIGHT_T;
@ -27,8 +28,9 @@ class Hashtable2{
HT_HASH_T hash;
#endif
};
using HashKeyFunc_t=HT_HASH_T (*)(TKey);
using KeyCmpFunc_t=bool (*)(TKey, TKey);
//using HashKeyFunc_t=HT_HASH_T (*)(TKey);
using HashKeyFunc_t=std::function<HT_HASH_T(TKey)>;
using KeyCmpFunc_t=std::function<bool(TKey, TKey)>;
// fields
Autoarr2<KeyValue>** rows;

View File

@ -26,6 +26,7 @@ typedef enum __attribute__((__packed__)) my_type {
AutoarrInt32Ptr, AutoarrUInt32Ptr, AutoarrInt64Ptr, AutoarrUInt64Ptr,
AutoarrUnitypePtr, AutoarrKVPairPtr
} my_type;
static const my_type my_type_last=AutoarrKVPairPtr;
const char* my_type_name(my_type t);

View File

@ -47,7 +47,7 @@ void test_searchtree(){
printuni(u);
ST_push(node,"message_id", u);
printf(" -> message_id\n ");
u=(Unitype){.type=Int8Ptr,.VoidPtr=malloc(1)};
u=(Unitype){.type=CharPtr,.VoidPtr=cptr_copy("some text UwU")};
printuni(u);
ST_push(node,"text", u);
printf(" -> text\n");