diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-24 11:15:14 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-24 11:15:14 +0000 |
| commit | 3d6825e0c58fe82ebd835ce5ecae2a9756104ce4 (patch) | |
| tree | 6cbd48336a061e79ea5787d6f756dcb65f0b4110 | |
| parent | 1fa6d12e0c0a2b9a383c946be39b4d6f09c5f826 (diff) | |
add debug macro
| -rw-r--r-- | malloclab-handout/util/mm-naive-free.h | 17 |
1 files 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<Args...> fmt, Args&&... args ) { if constexpr (OV4_VERBOSE) println(fmt, forward<Args>(args)...); } +void loggerln( std::format_string<Args...> fmt, Args&&... args ) +{ +#ifdef OV4_VERBOSE + println(fmt, forward<Args>(args)...); +#endif +} template< class... Args > -void logger( std::format_string<Args...> fmt, Args&&... args ) { if constexpr (OV4_VERBOSE) print(fmt, forward<Args>(args)...); } +void logger( std::format_string<Args...> fmt, Args&&... args ) +{ +#ifdef OV4_VERBOSE + print(fmt, forward<Args>(args)...); +#endif +} void print_list() |
