Index: ossp-pkg/ui64/README RCS File: /v/ossp/cvs/ossp-pkg/ui64/README,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/ui64/README,v' 2>/dev/null --- README 2003/03/23 18:07:15 1.3 +++ README 2004/01/09 11:24:20 1.4 @@ -1,9 +1,9 @@ - _ __ _ _ - _ _(_)/ /_ | || | - | | | | | '_ \| || |_ + _ __ _ _ + _ _(_)/ /_ | || | + | | | | | '_ \| || |_ | |_| | | (_) |__ _| - \__,_|_|\___/ |_| - + \__,_|_|\___/ |_| + OSSP ui64 - 64-Bit Arithmetic Version 0.1.0 (28-Apr-2002) Index: ossp-pkg/ui64/devtool RCS File: /v/ossp/cvs/ossp-pkg/ui64/devtool,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/ui64/devtool,v' 2>/dev/null --- devtool 2002/04/28 13:22:49 1.1 +++ devtool 2004/01/09 11:24:20 1.2 @@ -1,7 +1,7 @@ #!/bin/sh ## ## devtool -- Development Tool -## Copyright (c) 2001 Ralf S. Engelschall +## Copyright (c) 2001 Ralf S. Engelschall ## if [ $# -eq 0 ]; then Index: ossp-pkg/ui64/devtool.conf RCS File: /v/ossp/cvs/ossp-pkg/ui64/devtool.conf,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/ui64/devtool.conf,v' 2>/dev/null --- devtool.conf 2002/07/28 08:08:42 1.3 +++ devtool.conf 2004/01/09 11:24:21 1.4 @@ -23,7 +23,7 @@ %version ./shtool version -l txt -n "OSSP ui64" -e VERSION V=`./shtool version -l txt -d long VERSION` - sed -e "s/Version .*(.*)/Version $V/g" README.n + sed -e "s/Version .*(.*)/Version $V/g" README.n mv README.n README %dist Index: ossp-pkg/ui64/devtool.func RCS File: /v/ossp/cvs/ossp-pkg/ui64/devtool.func,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/ui64/devtool.func,v' 2>/dev/null --- devtool.func 2002/04/28 13:22:49 1.1 +++ devtool.func 2004/01/09 11:24:21 1.2 @@ -1,6 +1,6 @@ ## ## devtool.func -- Development Tool Functions -## Copyright (c) 2001-2002 Ralf S. Engelschall +## Copyright (c) 2001-2002 Ralf S. Engelschall ## devtool_require () { Index: ossp-pkg/ui64/ts.c RCS File: /v/ossp/cvs/ossp-pkg/ui64/ts.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/ui64/ts.c,v' 2>/dev/null --- ts.c 2002/04/28 13:22:49 1.1 +++ ts.c 2004/01/09 11:24:21 1.2 @@ -119,7 +119,7 @@ static int ts_suite_mvxprintf(char *buffer, size_t bufsize, const char *format, va_list ap) { /* sufficient integer buffer: x log_10(2) + safety */ - char ibuf[((sizeof(int)*8)/3)+10]; + char ibuf[((sizeof(int)*8)/3)+10]; char *cp; char c; int d; @@ -351,9 +351,9 @@ /* print test suite summary */ fprintf(stdout, " __________________________________________________________________\n"); fprintf(stdout, "\n"); - fprintf(stdout, " Test Summary: %d tests (%d ok, %d failed), %d checks (%d ok, %d failed)\n", - total_tests, (total_tests - total_tests_suite_failed), total_tests_suite_failed, - total_checks, (total_checks - total_checks_failed), total_checks_failed); + fprintf(stdout, " Test Summary: %d tests (%d ok, %d failed), %d checks (%d ok, %d failed)\n", + total_tests, (total_tests - total_tests_suite_failed), total_tests_suite_failed, + total_checks, (total_checks - total_checks_failed), total_checks_failed); if (total_tests_suite_failed > 0) fprintf(stdout, " Test Suite: FAILED\n"); else Index: ossp-pkg/ui64/ui64.c RCS File: /v/ossp/cvs/ossp-pkg/ui64/ui64.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/ui64/ui64.c,v' 2>/dev/null --- ui64.c 2003/03/23 18:07:15 1.3 +++ ui64.c 2004/01/09 11:24:21 1.4 @@ -109,15 +109,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) @@ -318,7 +318,7 @@ int i; int n, m; int ovn; - + /* determine actual number of involved digits */ n = ui64_len(x); m = ui64_len(y); @@ -364,7 +364,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/ui64/ui64.h RCS File: /v/ossp/cvs/ossp-pkg/ui64/ui64.h,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/ui64/ui64.h,v' 2>/dev/null --- ui64.h 2003/03/23 18:07:15 1.5 +++ ui64.h 2004/01/09 11:24:21 1.6 @@ -44,26 +44,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 Index: ossp-pkg/ui64/ui64.pod RCS File: /v/ossp/cvs/ossp-pkg/ui64/ui64.pod,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/ui64/ui64.pod,v' 2>/dev/null --- ui64.pod 2003/03/23 18:07:15 1.6 +++ ui64.pod 2004/01/09 11:24:21 1.7 @@ -40,28 +40,28 @@ =head1 SYNOPSIS -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B, -B. +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B, +B. =head1 DESCRIPTION @@ -144,7 +144,7 @@ =item ui64_t B(ui64_t I, ui64_t I, ui64_t *I); -Addition of I and I. +Addition of I and I. If I is not C, it receives the overflow value of this operation (carry). @@ -154,7 +154,7 @@ =item ui64_t B(ui64_t I, ui64_t I, ui64_t *I); -Subtraction of I from I. +Subtraction of I from I. If I is not C, it receives the overflow value of this operation (borrow). @@ -164,7 +164,7 @@ =item ui64_t B(ui64_t I, ui64_t I, ui64_t *I); -Multiplication of I and I. +Multiplication of I and I. If I is not C, it receives the overflow value of this operation). @@ -174,7 +174,7 @@ =item ui64_t B(ui64_t I, ui64_t I, ui64_t *I); -Division of I by I. +Division of I by I. If I is not C, it receives the overflow value of this operation (remainder). Index: ossp-pkg/ui64/ui64_test.c RCS File: /v/ossp/cvs/ossp-pkg/ui64/ui64_test.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/ui64/ui64_test.c,v' 2>/dev/null --- ui64_test.c 2003/03/23 18:07:16 1.2 +++ ui64_test.c 2004/01/09 11:24:21 1.3 @@ -56,7 +56,7 @@ n = ui64_i2n(x); if (n != table[i].num) { ts_test_fail(TS_CTX, "input %d, " - "expected output %d, got output %d", + "expected output %d, got output %d", table[i].num, table[i].num, n); } } @@ -92,9 +92,9 @@ cp = ui64_i2s(x, buf, sizeof(buf), table[i].in_base); if (strcasecmp(table[i].in_str, cp) != 0) { ts_test_fail(TS_CTX, "input \"%s\" (%d), " - "expected output \"%s\" (%d), got output \"%s\" (%d)", - table[i].in_str, table[i].in_base, - table[i].in_str, table[i].in_base, + "expected output \"%s\" (%d), got output \"%s\" (%d)", + table[i].in_str, table[i].in_base, + table[i].in_str, table[i].in_base, cp, table[i].in_base); } @@ -103,9 +103,9 @@ cp = ui64_i2s(x, buf, sizeof(buf), table[i].out_base); if (strcasecmp(table[i].out_str, cp) != 0) { ts_test_fail(TS_CTX, "input \"%s\" (%d), " - "expected output \"%s\" (%d), got output \"%s\" (%d)", - table[i].out_str, table[i].out_base, - table[i].out_str, table[i].out_base, + "expected output \"%s\" (%d), got output \"%s\" (%d)", + table[i].out_str, table[i].out_base, + table[i].out_str, table[i].out_base, cp, table[i].out_base); } @@ -114,9 +114,9 @@ cp = ui64_i2s(x, buf, sizeof(buf), table[i].out_base); if (strcasecmp(table[i].out_str, cp) != 0) { ts_test_fail(TS_CTX, "input \"%s\" (%d), " - "expected output \"%s\" (%d), got output \"%s\" (%d)", - table[i].in_str, table[i].in_base, - table[i].out_str, table[i].out_base, + "expected output \"%s\" (%d), got output \"%s\" (%d)", + table[i].in_str, table[i].in_base, + table[i].out_str, table[i].out_base, cp, table[i].out_base); } } @@ -131,11 +131,11 @@ char ov_a[128]; char *ov_s; struct { - char *a1; + char *a1; char *op; - char *a2; - char *re; - char *ov; + char *a2; + char *re; + char *ov; } table[] = { /* addition */ { "0", "+", "0", "0", "0" }, @@ -199,7 +199,7 @@ if ( strcasecmp(re_s, table[i].re) != 0 || strcasecmp(ov_s, table[i].ov) != 0) { ts_test_fail(TS_CTX, "%s %s %s = (expected) %s [%s] != %s [%s] (got)", - table[i].a1, table[i].op, table[i].a2, + table[i].a1, table[i].op, table[i].a2, table[i].re, table[i].ov, re_s, ov_s); } } @@ -215,11 +215,11 @@ char ov_a[128]; char *ov_s; struct { - char *a1; + char *a1; char *op; - int a2; - char *re; - char *ov; + int a2; + char *re; + char *ov; } table[] = { /* rotate left */ { "0", "<", 0, "0", "0" }, @@ -252,7 +252,7 @@ if ( strcasecmp(re_s, table[i].re) != 0 || strcasecmp(ov_s, table[i].ov) != 0) { ts_test_fail(TS_CTX, "%s %s %d = (expected) %s [%s] != %s [%s] (got)", - table[i].a1, table[i].op, table[i].a2, + table[i].a1, table[i].op, table[i].a2, table[i].re, table[i].ov, re_s, ov_s); } }