Commit f4babf69 authored by Robert Griesemer's avatar Robert Griesemer

- missed a few identifiers

R=r
OCL=22864
CL=22864
parent 364a8520
...@@ -86,7 +86,7 @@ func assert(p bool) { ...@@ -86,7 +86,7 @@ func assert(p bool) {
} }
func IsSmall(x Digit) bool { func isSmall(x Digit) bool {
return x < 1<<_LogH; return x < 1<<_LogH;
} }
...@@ -114,10 +114,10 @@ export func Dump(x []Digit) { ...@@ -114,10 +114,10 @@ export func Dump(x []Digit) {
export type Natural []Digit; export type Natural []Digit;
var ( var (
NatZero Natural = Natural{}; natZero Natural = Natural{};
NatOne Natural = Natural{1}; natOne Natural = Natural{1};
NatTwo Natural = Natural{2}; natTwo Natural = Natural{2};
NatTen Natural = Natural{10}; natTen Natural = Natural{10};
) )
...@@ -125,10 +125,10 @@ var ( ...@@ -125,10 +125,10 @@ var (
export func Nat(x uint) Natural { export func Nat(x uint) Natural {
switch x { switch x {
case 0: return NatZero; case 0: return natZero;
case 1: return NatOne; case 1: return natOne;
case 2: return NatTwo; case 2: return natTwo;
case 10: return NatTen; case 10: return natTen;
} }
assert(Digit(x) < _B); assert(Digit(x) < _B);
return Natural{Digit(x)}; return Natural{Digit(x)};
...@@ -608,7 +608,7 @@ func (x Natural) Log2() uint { ...@@ -608,7 +608,7 @@ func (x Natural) Log2() uint {
// Computes x = x div d in place (modifies x) for "small" d's. // Computes x = x div d in place (modifies x) for "small" d's.
// Returns updated x and x mod d. // Returns updated x and x mod d.
func divmod1(x Natural, d Digit) (Natural, Digit) { func divmod1(x Natural, d Digit) (Natural, Digit) {
assert(0 < d && IsSmall(d - 1)); assert(0 < d && isSmall(d - 1));
c := Digit(0); c := Digit(0);
for i := len(x) - 1; i >= 0; i-- { for i := len(x) - 1; i >= 0; i-- {
...@@ -679,8 +679,8 @@ func hexvalue(ch byte) uint { ...@@ -679,8 +679,8 @@ func hexvalue(ch byte) uint {
// Computes x = x*d + c for "small" d's. // Computes x = x*d + c for "small" d's.
func MulAdd1(x Natural, d, c Digit) Natural { func muladd1(x Natural, d, c Digit) Natural {
assert(IsSmall(d-1) && IsSmall(c)); assert(isSmall(d-1) && isSmall(c));
n := len(x); n := len(x);
z := make(Natural, n + 1); z := make(Natural, n + 1);
...@@ -716,7 +716,7 @@ export func NatFromString(s string, base uint, slen *int) (Natural, uint) { ...@@ -716,7 +716,7 @@ export func NatFromString(s string, base uint, slen *int) (Natural, uint) {
for ; i < n; i++ { for ; i < n; i++ {
d := hexvalue(s[i]); d := hexvalue(s[i]);
if d < base { if d < base {
x = MulAdd1(x, Digit(base), Digit(d)); x = muladd1(x, Digit(base), Digit(d));
} else { } else {
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment