fx.collections: update header directories
This commit is contained in:
+45
-15
@@ -1,6 +1,6 @@
|
||||
#include <fx/core/bitop.h>
|
||||
#include <fx/core/stream.h>
|
||||
#include <fx/ds/bitmap.h>
|
||||
#include <fx/bitop.h>
|
||||
#include <fx/collections/bitmap.h>
|
||||
#include <fx/stream.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BITS_PER_WORD (8 * sizeof(bitmap_word_t))
|
||||
@@ -36,11 +36,17 @@ static void bitmap_clear_bit(struct fx_bitmap_p *map, size_t bit)
|
||||
map->map_words[index] &= ~mask;
|
||||
}
|
||||
|
||||
static void bitmap_set_range(struct fx_bitmap_p *map, size_t first_bit, size_t nbits)
|
||||
static void bitmap_set_range(
|
||||
struct fx_bitmap_p *map,
|
||||
size_t first_bit,
|
||||
size_t nbits)
|
||||
{
|
||||
}
|
||||
|
||||
static void bitmap_clear_range(struct fx_bitmap_p *map, size_t first_bit, size_t nbits)
|
||||
static void bitmap_clear_range(
|
||||
struct fx_bitmap_p *map,
|
||||
size_t first_bit,
|
||||
size_t nbits)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -216,13 +222,21 @@ void fx_bitmap_clear_bit(fx_bitmap *map, size_t bit)
|
||||
void fx_bitmap_set_range(fx_bitmap *map, size_t first_bit, size_t nbits)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC_V(
|
||||
FX_TYPE_BITMAP, bitmap_set_range, map, first_bit, nbits);
|
||||
FX_TYPE_BITMAP,
|
||||
bitmap_set_range,
|
||||
map,
|
||||
first_bit,
|
||||
nbits);
|
||||
}
|
||||
|
||||
void fx_bitmap_clear_range(fx_bitmap *map, size_t first_bit, size_t nbits)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC_V(
|
||||
FX_TYPE_BITMAP, bitmap_clear_range, map, first_bit, nbits);
|
||||
FX_TYPE_BITMAP,
|
||||
bitmap_clear_range,
|
||||
map,
|
||||
first_bit,
|
||||
nbits);
|
||||
}
|
||||
|
||||
void fx_bitmap_set_all(fx_bitmap *map)
|
||||
@@ -247,7 +261,10 @@ size_t fx_bitmap_count_set_bits(const fx_bitmap *map)
|
||||
|
||||
size_t fx_bitmap_count_clear_bits(const fx_bitmap *map)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC_0(FX_TYPE_BITMAP, bitmap_count_clear_bits, map);
|
||||
FX_CLASS_DISPATCH_STATIC_0(
|
||||
FX_TYPE_BITMAP,
|
||||
bitmap_count_clear_bits,
|
||||
map);
|
||||
}
|
||||
|
||||
size_t fx_bitmap_highest_set_bit(const fx_bitmap *map)
|
||||
@@ -257,7 +274,10 @@ size_t fx_bitmap_highest_set_bit(const fx_bitmap *map)
|
||||
|
||||
size_t fx_bitmap_highest_clear_bit(const fx_bitmap *map)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC_0(FX_TYPE_BITMAP, bitmap_highest_clear_bit, map);
|
||||
FX_CLASS_DISPATCH_STATIC_0(
|
||||
FX_TYPE_BITMAP,
|
||||
bitmap_highest_clear_bit,
|
||||
map);
|
||||
}
|
||||
|
||||
size_t fx_bitmap_lowest_set_bit(const fx_bitmap *map)
|
||||
@@ -267,7 +287,10 @@ size_t fx_bitmap_lowest_set_bit(const fx_bitmap *map)
|
||||
|
||||
size_t fx_bitmap_lowest_clear_bit(const fx_bitmap *map)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC_0(FX_TYPE_BITMAP, bitmap_lowest_clear_bit, map);
|
||||
FX_CLASS_DISPATCH_STATIC_0(
|
||||
FX_TYPE_BITMAP,
|
||||
bitmap_lowest_clear_bit,
|
||||
map);
|
||||
}
|
||||
|
||||
/*** PUBLIC ALIAS FUNCTIONS ***************************************************/
|
||||
@@ -285,7 +308,8 @@ static void bitmap_fini(fx_object *obj, void *priv)
|
||||
|
||||
static void bitmap_to_string(const fx_object *obj, fx_stream *out)
|
||||
{
|
||||
const struct fx_bitmap_p *map = fx_object_get_private(obj, FX_TYPE_BITMAP);
|
||||
const struct fx_bitmap_p *map
|
||||
= fx_object_get_private(obj, FX_TYPE_BITMAP);
|
||||
|
||||
unsigned char *bytes = (unsigned char *)map->map_words;
|
||||
size_t nr_bytes = map->map_nr_words * sizeof(bitmap_word_t);
|
||||
@@ -294,10 +318,16 @@ static void bitmap_to_string(const fx_object *obj, fx_stream *out)
|
||||
for (size_t i = 0; i < nr_bytes - 1; i++) {
|
||||
c = bytes[i];
|
||||
fx_stream_write_fmt(
|
||||
out, NULL, "%c%c%c%c%c%c%c%c", c & 0x80 ? '1' : '0',
|
||||
c & 0x40 ? '1' : '0', c & 0x20 ? '1' : '0',
|
||||
c & 0x10 ? '1' : '0', c & 0x08 ? '1' : '0',
|
||||
c & 0x04 ? '1' : '0', c & 0x02 ? '1' : '0',
|
||||
out,
|
||||
NULL,
|
||||
"%c%c%c%c%c%c%c%c",
|
||||
c & 0x80 ? '1' : '0',
|
||||
c & 0x40 ? '1' : '0',
|
||||
c & 0x20 ? '1' : '0',
|
||||
c & 0x10 ? '1' : '0',
|
||||
c & 0x08 ? '1' : '0',
|
||||
c & 0x04 ? '1' : '0',
|
||||
c & 0x02 ? '1' : '0',
|
||||
c & 0x01 ? '1' : '0');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user