Much investigation of bignum problems
bignum multiply is still not working, but as bignum read and bignum divide depend on it, it's the problem to hit first.
This commit is contained in:
parent
000ae3c392
commit
0f8bc990f2
9 changed files with 372 additions and 173 deletions
31
src/debug.c
31
src/debug.c
|
|
@ -46,23 +46,24 @@ void debug_print( wchar_t *message, int level ) {
|
|||
* stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc
|
||||
*/
|
||||
void debug_print_128bit( __int128_t n, int level ) {
|
||||
#ifdef DEBUG
|
||||
if ( level & verbosity ) {
|
||||
if (n == 0) {
|
||||
fwprintf(stderr, L"0");
|
||||
} else {
|
||||
char str[40] = {0}; // log10(1 << 128) + '\0'
|
||||
char *s = str + sizeof(str) - 1; // start at the end
|
||||
while (n != 0) {
|
||||
if (s == str) return; // never happens
|
||||
#ifdef DEBUG
|
||||
if ( level & verbosity ) {
|
||||
if ( n == 0 ) {
|
||||
fwprintf( stderr, L"0" );
|
||||
} else {
|
||||
char str[40] = { 0 }; // log10(1 << 128) + '\0'
|
||||
char *s = str + sizeof( str ) - 1; // start at the end
|
||||
while ( n != 0 ) {
|
||||
if ( s == str )
|
||||
return; // never happens
|
||||
|
||||
*--s = "0123456789"[n % 10]; // save last digit
|
||||
n /= 10; // drop it
|
||||
}
|
||||
fwprintf(stderr, L"%s", s);
|
||||
*--s = "0123456789"[n % 10]; // save last digit
|
||||
n /= 10; // drop it
|
||||
}
|
||||
fwprintf( stderr, L"%s", s );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue