Moved pool file out of external definition and replaced it with a flag (#176)
* Moved pool file out of external definition and replaced it with a flag
This commit is contained in:
@@ -32,7 +32,6 @@ INCLUDES := include
|
||||
DATA :=
|
||||
MUSIC := audio
|
||||
GRAPHICS := graphics
|
||||
POOLS_DEF_FILE := \"def_balatro_mempool.h\"
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
@@ -44,7 +43,6 @@ GIT_HASH := $(shell git rev-parse --short HEAD || echo "undef")
|
||||
GIT_C_FLAGS := -DGIT_HASH=\"$(GIT_HASH)\" -DGIT_DIRTY=\"$(GIT_DIRTY)\"
|
||||
|
||||
CFLAGS := -g -O3 -Wall -Werror \
|
||||
-DPOOLS_DEF_FILE=$(POOLS_DEF_FILE) \
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi \
|
||||
-ffast-math -fomit-frame-pointer -funroll-loops \
|
||||
$(ARCH)
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef POOLS_TEST_ENV
|
||||
#define POOLS_DEF_FILE "def_test_mempool.h"
|
||||
#else
|
||||
#define POOLS_DEF_FILE "def_balatro_mempool.h"
|
||||
#endif
|
||||
|
||||
#define POOL_BITS_PER_WORD 32
|
||||
#define POOL_BITMAP_BYTES 8
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ int pool_bm_get_free_idx(PoolBitmap *bm)
|
||||
int bit = __builtin_ctz(inv);
|
||||
bm->w[i] |= ((uint32_t)1 << bit);
|
||||
int idx = i * POOL_BITS_PER_WORD + bit;
|
||||
return (idx < bm->cap) ? idx : -1;
|
||||
return (idx < bm->cap) ? idx : UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
POOLS_DEF_FILE := \"def_test_mempool.h\"
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -I../../include -I. \
|
||||
-g -O3 -Wall -Werror -DPOOLS_DEF_FILE=$(POOLS_DEF_FILE)
|
||||
-g -O3 -Wall -Werror -DPOOLS_TEST_ENV=yes
|
||||
|
||||
SRC := pool_test.c ../../source/pool.c
|
||||
OUT := build/pool_test
|
||||
|
||||
Reference in New Issue
Block a user