mirror of
https://git.sr.ht/~lattis/muon
synced 2026-01-29 19:04:20 +00:00
28 lines
838 B
C
28 lines
838 B
C
#ifndef MUON_DATA_BUCKET_ARRAY_H
|
|
#define MUON_DATA_BUCKET_ARRAY_H
|
|
|
|
#include "darr.h"
|
|
|
|
struct bucket_array {
|
|
struct darr buckets;
|
|
uint32_t item_size;
|
|
uint32_t bucket_size;
|
|
uint32_t len;
|
|
};
|
|
|
|
struct bucket {
|
|
uint8_t *mem;
|
|
uint32_t len;
|
|
};
|
|
|
|
void init_bucket(struct bucket_array *ba, struct bucket *b);
|
|
|
|
void bucket_array_init(struct bucket_array *ba, uint32_t bucket_size, uint32_t item_size);
|
|
void *bucket_array_push(struct bucket_array *ba, const void *item);
|
|
void *bucket_array_pushn(struct bucket_array *ba, const void *data, uint32_t data_len, uint32_t reserve);
|
|
void *bucket_array_get(const struct bucket_array *ba, uint32_t i);
|
|
void bucket_array_clear(struct bucket_array *ba);
|
|
void bucket_array_destroy(struct bucket_array *ba);
|
|
bool bucket_array_lookup_pointer(struct bucket_array *ba, const uint8_t *p, uint64_t *ret);
|
|
#endif
|