From 3d6825e0c58fe82ebd835ce5ecae2a9756104ce4 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 24 Oct 2026 11:15:14 +0000 Subject: add debug macro --- malloclab-handout/util/mm-naive-free.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/malloclab-handout/util/mm-naive-free.h b/malloclab-handout/util/mm-naive-free.h index 47a9f02..c618ca6 100644 --- a/malloclab-handout/util/mm-naive-free.h +++ b/malloclab-handout/util/mm-naive-free.h @@ -11,9 +11,6 @@ using namespace std; /* single word (4) or double word (8) alignment */ #define ALIGNMENT 8 - -inline constexpr bool OV4_VERBOSE = true; - /* rounds up to the nearest multiple of ALIGNMENT */ inline size_t align(size_t size) { @@ -64,10 +61,20 @@ inline void next(size_t &p) } template< class... Args > -void loggerln( std::format_string fmt, Args&&... args ) { if constexpr (OV4_VERBOSE) println(fmt, forward(args)...); } +void loggerln( std::format_string fmt, Args&&... args ) +{ +#ifdef OV4_VERBOSE + println(fmt, forward(args)...); +#endif +} template< class... Args > -void logger( std::format_string fmt, Args&&... args ) { if constexpr (OV4_VERBOSE) print(fmt, forward(args)...); } +void logger( std::format_string fmt, Args&&... args ) +{ +#ifdef OV4_VERBOSE + print(fmt, forward(args)...); +#endif +} void print_list() -- cgit v1.3.1-4-g156e