clean-up test.c
* no more `MP_WUR` in test.c * clean-up console output
This commit is contained in:
parent
8bf82f9435
commit
b250ec44e0
@ -1,3 +1,4 @@
|
||||
#define MP_WUR /* TODO: result checks disabled for now, T.b.d. if it should even be done here */
|
||||
#include "shared.h"
|
||||
|
||||
#ifdef LTM_MTEST_REAL_RAND
|
||||
|
@ -4,8 +4,12 @@ void ndraw(const mp_int *a, const char *name)
|
||||
{
|
||||
char *buf;
|
||||
size_t size;
|
||||
mp_err err;
|
||||
|
||||
mp_radix_size(a, 10, &size);
|
||||
if ((err = mp_radix_size(a, 10, &size)) != MP_OKAY) {
|
||||
fprintf(stderr, "\nndraw: mp_radix_size(a, 10, %zu) failed - %s\n", size, mp_error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
buf = (char *)malloc(size);
|
||||
if (buf == NULL) {
|
||||
fprintf(stderr, "\nndraw: malloc(%zu) failed\n", size);
|
||||
@ -13,9 +17,15 @@ void ndraw(const mp_int *a, const char *name)
|
||||
}
|
||||
|
||||
printf("%s: ", name);
|
||||
mp_to_decimal(a, buf, size);
|
||||
if ((err = mp_to_decimal(a, buf, size)) != MP_OKAY) {
|
||||
fprintf(stderr, "\nndraw: mp_to_decimal(a, buf, %zu) failed - %s\n", size, mp_error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("%s\n", buf);
|
||||
mp_to_hex(a, buf, size);
|
||||
if ((err = mp_to_hex(a, buf, size)) != MP_OKAY) {
|
||||
fprintf(stderr, "\nndraw: mp_to_hex(a, buf, %zu) failed - %s\n", size, mp_error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("0x%s\n", buf);
|
||||
|
||||
free(buf);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#define LTM_DEMO_TEST_REDUCE_2K_L 0
|
||||
#endif
|
||||
|
||||
#define MP_WUR /* TODO: result checks disabled for now */
|
||||
#include "tommath_private.h"
|
||||
|
||||
extern void ndraw(const mp_int* a, const char* name);
|
||||
|
996
demo/test.c
996
demo/test.c
File diff suppressed because it is too large
Load Diff
@ -204,7 +204,7 @@ mp_err mp_init_size(mp_int *a, int size) MP_WUR;
|
||||
|
||||
/* ---> Basic Manipulations <--- */
|
||||
#define mp_iszero(a) ((a)->used == 0)
|
||||
#define mp_isneg(a) ((a)->sign != MP_ZPOS)
|
||||
#define mp_isneg(a) ((a)->sign == MP_NEG)
|
||||
#define mp_iseven(a) (((a)->used == 0) || (((a)->dp[0] & 1u) == 0u))
|
||||
#define mp_isodd(a) (!mp_iseven(a))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user