Skip to content

Commit da6514a

Browse files
config: Introduce DEBUG_CONFIG macro for debug output of config
1 parent d0cf55e commit da6514a

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/ecmult.h

+8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313

1414
#ifndef ECMULT_WINDOW_SIZE
1515
# define ECMULT_WINDOW_SIZE 15
16+
# ifdef DEBUG_CONFIG
17+
# pragma message DEBUG_CONFIG_MSG("ECMULT_WINDOW_SIZE undefined, assuming default value")
18+
# endif
1619
#endif
20+
21+
#ifdef DEBUG_CONFIG
22+
# pragma message DEBUG_CONFIG_DEF(ECMULT_WINDOW_SIZE)
23+
#endif
24+
1725
/* Noone will ever need more than a window size of 24. The code might
1826
* be correct for larger values of ECMULT_WINDOW_SIZE but this is not
1927
* tested.

src/ecmult_gen.h

+9
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@
1212

1313
#ifndef ECMULT_GEN_PREC_BITS
1414
# define ECMULT_GEN_PREC_BITS 4
15+
# ifdef DEBUG_CONFIG
16+
# pragma message DEBUG_CONFIG_MSG("ECMULT_GEN_PREC_BITS undefined, assuming default value")
17+
# endif
1518
#endif
19+
20+
#ifdef DEBUG_CONFIG
21+
# pragma message DEBUG_CONFIG_DEF(ECMULT_GEN_PREC_BITS)
22+
#endif
23+
1624
#if ECMULT_GEN_PREC_BITS != 2 && ECMULT_GEN_PREC_BITS != 4 && ECMULT_GEN_PREC_BITS != 8
1725
# error "Set ECMULT_GEN_PREC_BITS to 2, 4 or 8."
1826
#endif
27+
1928
#define ECMULT_GEN_PREC_G(bits) (1 << bits)
2029
#define ECMULT_GEN_PREC_N(bits) (256 / bits)
2130

src/util.h

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#include <stdio.h>
1717
#include <limits.h>
1818

19+
#define STR_(x) #x
20+
#define STR(x) STR_(x)
21+
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
22+
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))
23+
1924
typedef struct {
2025
void (*fn)(const char *text, void* data);
2126
const void* data;

0 commit comments

Comments
 (0)