diff --git a/GL/profiler.c b/GL/profiler.c index 49d353b..f6ea402 100644 --- a/GL/profiler.c +++ b/GL/profiler.c @@ -9,6 +9,8 @@ #ifdef PROFILER_COMPILE #include "../containers/aligned_vector.h" +#ifdef PROFILER_COMPILE + #define MAX_PATH 256 typedef struct { @@ -129,7 +131,7 @@ void profiler_pop() { aligned_vector_resize(&root->stack, root->stack.size - 1); } - +#include void profiler_print_stats() { if(!PROFILER_ENABLED) return; @@ -143,7 +145,7 @@ void profiler_print_stats() { float avg = ms / (float) result->total_calls; total_ms += ms; - fprintf(stderr, "%-60s%-20f%-20f%u\n", result->name, avg, ms, result->total_calls); + fprintf(stderr, "%-60s%-20f%-20f%" PRIu64 "\n", result->name, (double)avg, (double)ms, result->total_calls); } total_ms/=((ProfilerResult*)aligned_vector_at(&root->results, i-1))->total_calls; fps = 1000/total_ms; diff --git a/containers/named_array.c b/containers/named_array.c index c028e96..588eb10 100644 --- a/containers/named_array.c +++ b/containers/named_array.c @@ -12,6 +12,17 @@ #include "named_array.h" +#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" +#define BYTE_TO_BINARY(byte) \ + (byte & 0x80 ? '1' : '0'), \ + (byte & 0x40 ? '1' : '0'), \ + (byte & 0x20 ? '1' : '0'), \ + (byte & 0x10 ? '1' : '0'), \ + (byte & 0x08 ? '1' : '0'), \ + (byte & 0x04 ? '1' : '0'), \ + (byte & 0x02 ? '1' : '0'), \ + (byte & 0x01 ? '1' : '0') + void named_array_init(NamedArray* array, unsigned int element_size, unsigned int max_elements) { array->element_size = element_size; array->max_element_count = max_elements; @@ -33,7 +44,7 @@ void named_array_init(NamedArray* array, unsigned int element_size, unsigned int char named_array_used(NamedArray* array, unsigned int id) { unsigned int i = id / 8; unsigned int j = id % 8; - + unsigned char v = array->used_markers[i] & (unsigned char) (1 << j); return !!(v); } @@ -60,8 +71,7 @@ void* named_array_reserve(NamedArray* array, unsigned int id) { if(!named_array_used(array, id)) { unsigned int j = (id % 8); unsigned int i = id / 8; - - assert(!named_array_used(array, id)); + array->used_markers[i] |= (unsigned char) 1 << j; assert(named_array_used(array, id));