Initial commit
This commit is contained in:
30
include/bh/internal/hashmap.h
Normal file
30
include/bh/internal/hashmap.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef BHLIB_INTERNAL_HASHMAP_H
|
||||
#define BHLIB_INTERNAL_HASHMAP_H
|
||||
|
||||
#include <bh/hashmap.h>
|
||||
|
||||
typedef struct bh_hashmap_node_s
|
||||
{
|
||||
void *key;
|
||||
void *value;
|
||||
} bh_hashmap_node_t;
|
||||
|
||||
struct bh_hashmap_s
|
||||
{
|
||||
bh_hashmap_node_t *data;
|
||||
size_t *psls;
|
||||
size_t size;
|
||||
size_t capacity;
|
||||
size_t threshold;
|
||||
bh_equal_cb_t equal;
|
||||
bh_hash_cb_t hash;
|
||||
float factor;
|
||||
};
|
||||
|
||||
void bh_hashmap_init(bh_hashmap_t *hashmap,
|
||||
bh_equal_cb_t equal,
|
||||
bh_hash_cb_t hash);
|
||||
|
||||
void bh_hashmap_destroy(bh_hashmap_t *hashmap);
|
||||
|
||||
#endif /* BHLIB_INTERNAL_HASHMAP_H */
|
||||
35
include/bh/internal/queue.h
Normal file
35
include/bh/internal/queue.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef BHLIB_INTERNAL_QUEUE_H
|
||||
#define BHLIB_INTERNAL_QUEUE_H
|
||||
|
||||
#include <bh/queue.h>
|
||||
|
||||
struct bh_queue_s
|
||||
{
|
||||
void **data;
|
||||
size_t size;
|
||||
size_t head;
|
||||
size_t tail;
|
||||
size_t capacity;
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Initialize embedded queue object.
|
||||
*
|
||||
* @param queue Valid pointer to the queue object.
|
||||
*
|
||||
* @sa bh_queue_destroy
|
||||
*/
|
||||
void bh_queue_init(bh_queue_t *queue);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Destroy embedded queue object.
|
||||
*
|
||||
* @param queue Valid pointer to the queue object.
|
||||
*
|
||||
* @sa bh_queue_init
|
||||
*/
|
||||
void bh_queue_destroy(bh_queue_t *queue);
|
||||
|
||||
#endif /* BHLIB_INTERNAL_QUEUE_H */
|
||||
Reference in New Issue
Block a user