fx.collections: update interface implementations

This commit is contained in:
2026-05-25 17:30:08 +01:00
parent 0be82c63fa
commit 97fe00d4a1
4 changed files with 141 additions and 94 deletions
+10 -3
View File
@@ -1,6 +1,7 @@
#include <fx/bitop.h>
#include <fx/collections/bitmap.h>
#include <fx/stream.h>
#include <fx/value.h>
#include <string.h>
#define BITS_PER_WORD (8 * sizeof(bitmap_word_t))
@@ -306,10 +307,14 @@ static void bitmap_fini(fx_object *obj, void *priv)
struct fx_bitmap_p *map = priv;
}
static void bitmap_to_string(const fx_object *obj, fx_stream *out)
static fx_status bitmap_to_string(
const fx_value *obj,
fx_stream *out,
const char *format)
{
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->v_object,
FX_TYPE_BITMAP);
unsigned char *bytes = (unsigned char *)map->map_words;
size_t nr_bytes = map->map_nr_words * sizeof(bitmap_word_t);
@@ -339,6 +344,8 @@ static void bitmap_to_string(const fx_object *obj, fx_stream *out)
fx_stream_write_fmt(out, NULL, "%c", (c & mask) ? '1' : '0');
}
return FX_SUCCESS;
}
/*** CLASS DEFINITION *********************************************************/