change the encoding of uints to simplify overflow checking and to make them

easier and faster to read.  they are now either a one-byte value or a n-byte value
preceded by a byte holding -n.

R=rsc
DELTA=150  (45 added, 7 deleted, 98 changed)
OCL=32381
CL=32387
This commit is contained in:
Rob Pike 2009-07-28 17:20:19 -07:00
parent 189153ed13
commit b85147cd70
7 changed files with 137 additions and 99 deletions

View file

@ -50,8 +50,7 @@ func TestBasicEncoder(t *testing.T) {
}
// Decode the result by hand to verify;
state := new(decodeState);
state.b = b;
state := newDecodeState(b);
// The output should be:
// 0) The length, 38.
length := decodeUint(state);