opponent/test.c: move ndraw to main.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/demo/main.c b/demo/main.c
index 5b57813..dc68ee9 100644
--- a/demo/main.c
+++ b/demo/main.c
@@ -3,6 +3,17 @@
int mtest_opponent(void);
int unit_tests(void);
+void ndraw(mp_int *a, const char *name)
+{
+ char buf[16000]; /* TODO: buffer might overflow! */
+
+ printf("%s: ", name);
+ mp_toradix(a, buf, 10);
+ printf("%s\n", buf);
+ mp_toradix(a, buf, 16);
+ printf("0x%s\n", buf);
+}
+
int main(void)
{
srand(LTM_DEMO_RAND_SEED);
diff --git a/demo/opponent.c b/demo/opponent.c
index 329ed3f..b52ff72 100644
--- a/demo/opponent.c
+++ b/demo/opponent.c
@@ -1,17 +1,5 @@
#include "shared.h"
-/* TODO: Duplicate ndraw in test.c */
-static void ndraw(mp_int *a, const char *name)
-{
- char buf[16000]; /* TODO: buffer might overflow! */
-
- printf("%s: ", name);
- mp_toradix(a, buf, 10);
- printf("%s\n", buf);
- mp_toradix(a, buf, 16);
- printf("0x%s\n", buf);
-}
-
static void draw(mp_int *a)
{
ndraw(a, "");
diff --git a/demo/shared.h b/demo/shared.h
index 4481931..7be8e86 100644
--- a/demo/shared.h
+++ b/demo/shared.h
@@ -24,3 +24,5 @@
#endif
#include "tommath.h"
+
+void ndraw(mp_int*, const char*);
diff --git a/demo/test.c b/demo/test.c
index d62b7f3..346f571 100644
--- a/demo/test.c
+++ b/demo/test.c
@@ -1,17 +1,5 @@
#include "shared.h"
-/* TODO: Duplicate ndraw in opponent.c */
-static void ndraw(mp_int *a, const char *name)
-{
- char buf[16000]; /* TODO: buffer might overflow! */
-
- printf("%s: ", name);
- mp_toradix(a, buf, 10);
- printf("%s\n", buf);
- mp_toradix(a, buf, 16);
- printf("0x%s\n", buf);
-}
-
static int test_trivial_stuff(void) {
mp_int a, b, c, d;
if (mp_init_multi(&a, &b, &c, &d, NULL)!= MP_OKAY) {