MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / mi_bitmap_init

Function mi_bitmap_init

system/lib/mimalloc/src/bitmap.c:1034–1043  ·  view source on GitHub ↗

initialize a bitmap to all unset; avoid a mem_zero if `already_zero` is true returns the size of the bitmap

Source from the content-addressed store, hash-verified

1032// initialize a bitmap to all unset; avoid a mem_zero if `already_zero` is true
1033// returns the size of the bitmap
1034size_t mi_bitmap_init(mi_bitmap_t* bitmap, size_t bit_count, bool already_zero) {
1035 size_t chunk_count;
1036 const size_t size = mi_bitmap_size(bit_count, &chunk_count);
1037 if (!already_zero) {
1038 _mi_memzero_aligned(bitmap, size);
1039 }
1040 mi_atomic_store_release(&bitmap->chunk_count, chunk_count);
1041 mi_assert_internal(mi_atomic_load_relaxed(&bitmap->chunk_count) <= MI_BITMAP_MAX_CHUNK_COUNT);
1042 return size;
1043}
1044
1045
1046// Set a sequence of `n` bits in the bitmap (and can cross chunks). Not atomic so only use if local to a thread.

Callers 4

_mi_page_map_initFunction · 0.85
bitmap.hFile · 0.85
mi_arena_bitmap_initFunction · 0.85

Calls 2

mi_bitmap_sizeFunction · 0.85
_mi_memzero_alignedFunction · 0.85

Tested by

no test coverage detected