initial commit

This commit is contained in:
Erin Catto 2026-05-10 13:36:52 -07:00
commit 573e1a9fa3
220 changed files with 150440 additions and 0 deletions

43
src/id_pool.h Normal file
View file

@ -0,0 +1,43 @@
// SPDX-FileCopyrightText: 2025 Erin Catto
// SPDX-License-Identifier: MIT
#pragma once
#include "container.h"
typedef struct b3IdPool
{
b3ArrayC( int ) freeArray;
int nextIndex;
} b3IdPool;
#ifdef __cplusplus
extern "C"
{
#endif
b3IdPool b3CreateIdPool( void );
void b3DestroyIdPool( b3IdPool* pool );
int b3AllocId( b3IdPool* pool );
void b3FreeId( b3IdPool* pool, int id );
void b3ValidateFreeId( const b3IdPool* pool, int id );
#ifdef __cplusplus
}
#endif
B3_INLINE int b3GetIdCount( const b3IdPool* pool )
{
return pool->nextIndex - pool->freeArray.count;
}
B3_INLINE int b3GetIdCapacity( const b3IdPool* pool )
{
return pool->nextIndex;
}
B3_INLINE int b3GetIdBytes( const b3IdPool* pool )
{
return b3Array_ByteCount( pool->freeArray );
}