Compare commits
2 Commits
37fa19f6be
...
7fd472c17c
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fd472c17c | |||
| 80c19f9331 |
@@ -24,7 +24,7 @@ CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -march=native
|
||||
|
||||
CFLAGS += -DDEBUG # activate general debug (debug.c)
|
||||
CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c)
|
||||
CFLAGS += -DDEBUG_POOL # memory pools management
|
||||
|
||||
INCDIR := ./include
|
||||
|
||||
@@ -24,7 +24,7 @@ LDLIB := -l$(LIB)
|
||||
export LD_LIBRARY_PATH = $(LIBDIR)
|
||||
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -O2
|
||||
#CFLAGS += -O2
|
||||
CFLAGS += -g
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
@@ -32,6 +32,9 @@ CFLAGS += -march=native
|
||||
CFLAGS += -Wmissing-declarations
|
||||
CFLAGS += -Wno-unused-result
|
||||
|
||||
CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c)
|
||||
CFLAGS += -DDEBUG_POOL # memory pools management
|
||||
|
||||
TIME := \time -f "\ttime: %E real, %U user, %S sys\n\tcontext-switch:\t%c+%w, page-faults: %F+%R\n"
|
||||
export PATH := .:$(PATH)
|
||||
|
||||
@@ -52,4 +55,4 @@ clean:
|
||||
|
||||
.c:
|
||||
@echo compiling $<
|
||||
@$(CC) $(CFLAGS) $(LDFLAGS) -I $(INCDIR) $< $(LDLIB) -o $@
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -I $(INCDIR) $< $(LDLIB) -o $@
|
||||
|
||||
@@ -297,3 +297,7 @@ After step 100:
|
||||
After 100 steps, there have been a total of 1656 flashes.
|
||||
|
||||
Given the starting energy levels of the dumbo octopuses in your cavern, simulate 100 steps. How many total flashes are there after 100 steps?
|
||||
|
||||
Your puzzle answer was 1739.
|
||||
|
||||
The first half of this puzzle is complete! It provides one gold star: *
|
||||
|
||||
@@ -19,13 +19,22 @@
|
||||
|
||||
#include "bits.h"
|
||||
|
||||
#ifdef DEBUG_DEBUG
|
||||
void debug_init(u32 level);
|
||||
void debug_level_set(u32 level);
|
||||
void debug_devel_set(u32 level);
|
||||
void debug(u32 level, bool timestamp, u32 indent,
|
||||
const char *src, u32 line, const char *, ...);
|
||||
|
||||
#ifdef DEBUG
|
||||
#else /* DEBUG_DEBUG */
|
||||
#define _unused __attribute__((__unused__))
|
||||
static inline void debug_init(_unused u32 level) {}
|
||||
static inline void debug_level_set(_unused u32 level) {}
|
||||
static inline void debug_devel_set(_unused u32 level) {}
|
||||
static inline void debug(_unused u32 level, _unused bool timestamp,
|
||||
_unused u32 indent, _unused const char *src,
|
||||
_unused u32 line, const char *, ...) {}
|
||||
#undef _unused
|
||||
#endif /* DEBUG_DEBUG */
|
||||
|
||||
/* format: only printf
|
||||
*/
|
||||
@@ -63,6 +72,4 @@ void debug(u32 level, bool timestamp, u32 indent,
|
||||
#define log_it(...)
|
||||
#define log_f(...)
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef DEBUG_DEBUG
|
||||
#define DEBUG_DEBUG
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#define NANOSEC 1000000000 /* nano sec in sec */
|
||||
|
||||
Reference in New Issue
Block a user