Index: ossp-pkg/tai/tai_ui64.c RCS File: /v/ossp/cvs/ossp-pkg/tai/tai_ui64.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/tai/tai_ui64.c,v' 2>/dev/null --- tai_ui64.c 2003/03/23 18:00:29 1.2 +++ tai_ui64.c 2005/01/24 10:52:52 1.3 @@ -1,8 +1,7 @@ /* ** OSSP ui64 - 64-Bit Arithmetic -** Copyright (c) 2002-2003 Ralf S. Engelschall -** Copyright (c) 2002-2003 The OSSP Project -** Copyright (c) 2002-2003 Cable & Wireless Deutschland +** Copyright (c) 2002-2005 Ralf S. Engelschall +** Copyright (c) 2002-2005 The OSSP Project ** ** This file is part of OSSP ui64, a 64-bit arithmetic library ** which can be found at http://www.ossp.org/pkg/lib/ui64/. @@ -109,15 +108,15 @@ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* a...m */ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 /* m...z */ }; - + ui64_fill(z, 0); if (str == NULL || (base < 2 || base > 36)) return z; cp = str; while (*cp != '\0' && isspace((int)(*cp))) cp++; - while ( *cp != '\0' - && isalnum((int)(*cp)) + while ( *cp != '\0' + && isalnum((int)(*cp)) && map[(int)(*cp)-'0'] < base) { z = ui64_muln(z, base, &carry); if (carry) @@ -150,7 +149,7 @@ str[i++] = map[r]; while (n > 1 && x.x[n-1] == 0) n--; - } while (i < (len-1) && (n > 1 || x.x[0] != 0)); + } while (i < ((int)len-1) && (n > 1 || x.x[0] != 0)); str[i] = '\0'; for (j = 0; j < --i; j++) { c = str[j]; @@ -318,7 +317,7 @@ int i; int n, m; int ovn; - + /* determine actual number of involved digits */ n = ui64_len(x); m = ui64_len(y); @@ -364,7 +363,7 @@ qk := rx[k+m-2...k+m]/y[m-2...m-1] */ km = k + m; y2 = (y.x[m-1]*UI64_BASE) + y.x[m-2]; - r3 = (rx.x[km]*(UI64_BASE*UI64_BASE)) + + r3 = (rx.x[km]*(UI64_BASE*UI64_BASE)) + (rx.x[km-1]*UI64_BASE) + rx.x[km-2]; qk = r3 / y2; if (qk >= UI64_BASE) Index: ossp-pkg/tai/tai_ui64.h RCS File: /v/ossp/cvs/ossp-pkg/tai/tai_ui64.h,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/tai/tai_ui64.h,v' 2>/dev/null --- tai_ui64.h 2003/03/23 18:00:29 1.3 +++ tai_ui64.h 2005/01/24 10:52:52 1.4 @@ -1,8 +1,7 @@ /* ** OSSP ui64 - 64-Bit Arithmetic -** Copyright (c) 2002-2003 Ralf S. Engelschall -** Copyright (c) 2002-2003 The OSSP Project -** Copyright (c) 2002-2003 Cable & Wireless Deutschland +** Copyright (c) 2002-2005 Ralf S. Engelschall +** Copyright (c) 2002-2005 The OSSP Project ** ** This file is part of OSSP ui64, a 64-bit arithmetic library ** which can be found at http://www.ossp.org/pkg/lib/ui64/. @@ -46,26 +45,26 @@ #endif #define ui64_t UI64_CONCAT(UI64_PREFIX,ui64_t) #define ui64_zero UI64_CONCAT(UI64_PREFIX,ui64_zero) -#define ui64_max UI64_CONCAT(UI64_PREFIX,ui64_max) -#define ui64_n2i UI64_CONCAT(UI64_PREFIX,ui64_n2i) -#define ui64_i2n UI64_CONCAT(UI64_PREFIX,ui64_i2n) -#define ui64_s2i UI64_CONCAT(UI64_PREFIX,ui64_s2i) -#define ui64_i2s UI64_CONCAT(UI64_PREFIX,ui64_i2s) -#define ui64_add UI64_CONCAT(UI64_PREFIX,ui64_add) +#define ui64_max UI64_CONCAT(UI64_PREFIX,ui64_max) +#define ui64_n2i UI64_CONCAT(UI64_PREFIX,ui64_n2i) +#define ui64_i2n UI64_CONCAT(UI64_PREFIX,ui64_i2n) +#define ui64_s2i UI64_CONCAT(UI64_PREFIX,ui64_s2i) +#define ui64_i2s UI64_CONCAT(UI64_PREFIX,ui64_i2s) +#define ui64_add UI64_CONCAT(UI64_PREFIX,ui64_add) #define ui64_addn UI64_CONCAT(UI64_PREFIX,ui64_addn) -#define ui64_sub UI64_CONCAT(UI64_PREFIX,ui64_sub) +#define ui64_sub UI64_CONCAT(UI64_PREFIX,ui64_sub) #define ui64_subn UI64_CONCAT(UI64_PREFIX,ui64_subn) -#define ui64_mul UI64_CONCAT(UI64_PREFIX,ui64_mul) +#define ui64_mul UI64_CONCAT(UI64_PREFIX,ui64_mul) #define ui64_muln UI64_CONCAT(UI64_PREFIX,ui64_muln) -#define ui64_div UI64_CONCAT(UI64_PREFIX,ui64_div) +#define ui64_div UI64_CONCAT(UI64_PREFIX,ui64_div) #define ui64_divn UI64_CONCAT(UI64_PREFIX,ui64_divn) -#define ui64_and UI64_CONCAT(UI64_PREFIX,ui64_and) -#define ui64_or UI64_CONCAT(UI64_PREFIX,ui64_or) -#define ui64_xor UI64_CONCAT(UI64_PREFIX,ui64_xor) -#define ui64_not UI64_CONCAT(UI64_PREFIX,ui64_not) -#define ui64_rol UI64_CONCAT(UI64_PREFIX,ui64_rol) -#define ui64_ror UI64_CONCAT(UI64_PREFIX,ui64_ror) -#define ui64_len UI64_CONCAT(UI64_PREFIX,ui64_len) +#define ui64_and UI64_CONCAT(UI64_PREFIX,ui64_and) +#define ui64_or UI64_CONCAT(UI64_PREFIX,ui64_or) +#define ui64_xor UI64_CONCAT(UI64_PREFIX,ui64_xor) +#define ui64_not UI64_CONCAT(UI64_PREFIX,ui64_not) +#define ui64_rol UI64_CONCAT(UI64_PREFIX,ui64_rol) +#define ui64_ror UI64_CONCAT(UI64_PREFIX,ui64_ror) +#define ui64_len UI64_CONCAT(UI64_PREFIX,ui64_len) #define ui64_cmp UI64_CONCAT(UI64_PREFIX,ui64_cmp) #endif