]> Cypherpunks repositories - gostls13.git/commitdiff
I guess I forgot there was a unary ^ operator.
authorRuss Cox <rsc@golang.org>
Thu, 21 May 2009 18:52:20 +0000 (11:52 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 21 May 2009 18:52:20 +0000 (11:52 -0700)
R=r
DELTA=3  (0 added, 1 deleted, 2 changed)
OCL=29151
CL=29176

src/lib/hash/crc32/crc32.go

index 7fc3966aea9e755b987a3e7c03c7c8a8fde83e05..22a0f68f6ca7b3961198e92a71a4bd4a1c1ce05f 100644 (file)
@@ -81,12 +81,11 @@ func (d *digest) Reset() {
 }
 
 func update(crc uint32, tab *Table, p []byte) uint32 {
-       crc ^= 0xFFFFFFFF;
+       crc = ^crc;
        for i := 0; i < len(p); i++ {
                crc = tab[byte(crc) ^ p[i]] ^ (crc >> 8);
        }
-       crc ^= 0xFFFFFFFF;
-       return crc;
+       return ^crc;
 }
 
 func (d *digest) Write(p []byte) (n int, err os.Error) {