+void test_div_bigint(void){
+ bigint_t a, b, c, d;
+ printf_P(PSTR("\ndiv test\n"));
+ for (;;) {
+ printf_P(PSTR("\nenter a:"));
+ if (bigint_read_hex_echo(&a, 0)) {
+ printf_P(PSTR("\n end div test"));
+ return;
+ }
+ printf_P(PSTR("\nenter b:"));
+ if (bigint_read_hex_echo(&b, 0)) {
+ free(a.wordv);
+ printf_P(PSTR("\n end div test"));
+ return;
+ }
+ printf_P(PSTR("\n "));
+ bigint_print_hex(&a);
+ printf_P(PSTR(" / "));
+ bigint_print_hex(&b);
+ printf_P(PSTR(" = "));
+ memset(&c, 0, sizeof(c));
+ memset(&d, 0, sizeof(d));
+ bigint_divide(&d, &c, &a, &b);
+ bigint_print_hex(&d);
+ printf_P(PSTR("; R = "));
+ bigint_print_hex(&c);
+ printf_P(PSTR("\n"));
+ bigint_free(&d);
+ bigint_free(&c);
+ bigint_free(&b);
+ bigint_free(&a);
+ }
+}
+
+