2019-03-04 00:02:22 +00:00
|
|
|
#include "shared.h"
|
|
|
|
|
2019-04-04 05:58:07 +00:00
|
|
|
void ndraw(mp_int *a, const char *name)
|
2019-03-04 00:56:06 +00:00
|
|
|
{
|
2019-09-08 21:29:44 +00:00
|
|
|
char *buf = NULL;
|
2019-03-04 01:00:28 +00:00
|
|
|
int size;
|
|
|
|
|
|
|
|
mp_radix_size(a, 10, &size);
|
2019-05-12 22:22:18 +00:00
|
|
|
buf = (char *)malloc((size_t) size);
|
2019-03-04 01:00:28 +00:00
|
|
|
if (buf == NULL) {
|
|
|
|
fprintf(stderr, "\nndraw: malloc(%d) failed\n", size);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2019-03-04 00:56:06 +00:00
|
|
|
|
|
|
|
printf("%s: ", name);
|
2019-09-02 15:52:36 +00:00
|
|
|
mp_to_decimal(a, buf, (size_t) size);
|
2019-03-04 00:56:06 +00:00
|
|
|
printf("%s\n", buf);
|
2019-09-02 15:52:36 +00:00
|
|
|
mp_to_hex(a, buf, (size_t) size);
|
2019-03-04 00:56:06 +00:00
|
|
|
printf("0x%s\n", buf);
|
2019-03-04 01:00:28 +00:00
|
|
|
|
|
|
|
free(buf);
|
2019-03-04 00:56:06 +00:00
|
|
|
}
|
|
|
|
|
2019-09-10 14:05:27 +00:00
|
|
|
void print_header(void)
|
2019-03-04 00:02:22 +00:00
|
|
|
{
|
|
|
|
#ifdef MP_8BIT
|
|
|
|
printf("Digit size 8 Bit \n");
|
|
|
|
#endif
|
|
|
|
#ifdef MP_16BIT
|
|
|
|
printf("Digit size 16 Bit \n");
|
|
|
|
#endif
|
|
|
|
#ifdef MP_32BIT
|
|
|
|
printf("Digit size 32 Bit \n");
|
|
|
|
#endif
|
|
|
|
#ifdef MP_64BIT
|
|
|
|
printf("Digit size 64 Bit \n");
|
|
|
|
#endif
|
|
|
|
printf("Size of mp_digit: %u\n", (unsigned int)sizeof(mp_digit));
|
|
|
|
printf("Size of mp_word: %u\n", (unsigned int)sizeof(mp_word));
|
2019-04-13 06:46:57 +00:00
|
|
|
printf("MP_DIGIT_BIT: %d\n", MP_DIGIT_BIT);
|
2019-03-04 00:02:22 +00:00
|
|
|
printf("MP_PREC: %d\n", MP_PREC);
|
|
|
|
}
|