diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 21:54:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 21:54:22 +0000 |
commit | af92e385667da3fc91ac7f9f0867a56c111110b8 (patch) | |
tree | c8e8990a2197e33f6fe50a28a16714aafe982102 /libgo/go/hash | |
parent | df1304ee03f41aed179545d1e8b4684cfd22bbdf (diff) | |
download | gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.zip gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.tar.gz gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.tar.bz2 |
libgo: Update to weekly.2012-01-20.
From-SVN: r183540
Diffstat (limited to 'libgo/go/hash')
-rw-r--r-- | libgo/go/hash/adler32/adler32.go | 2 | ||||
-rw-r--r-- | libgo/go/hash/crc32/crc32.go | 2 | ||||
-rw-r--r-- | libgo/go/hash/crc64/crc64.go | 2 | ||||
-rw-r--r-- | libgo/go/hash/fnv/fnv.go | 5 | ||||
-rw-r--r-- | libgo/go/hash/hash.go | 6 |
5 files changed, 17 insertions, 0 deletions
diff --git a/libgo/go/hash/adler32/adler32.go b/libgo/go/hash/adler32/adler32.go index 8103a89..64fe68c 100644 --- a/libgo/go/hash/adler32/adler32.go +++ b/libgo/go/hash/adler32/adler32.go @@ -38,6 +38,8 @@ func New() hash.Hash32 { func (d *digest) Size() int { return Size } +func (d *digest) BlockSize() int { return 1 } + // Add p to the running checksum a, b. func update(a, b uint32, p []byte) (aa, bb uint32) { for _, pi := range p { diff --git a/libgo/go/hash/crc32/crc32.go b/libgo/go/hash/crc32/crc32.go index 557fab8..236d778 100644 --- a/libgo/go/hash/crc32/crc32.go +++ b/libgo/go/hash/crc32/crc32.go @@ -94,6 +94,8 @@ func NewIEEE() hash.Hash32 { return New(IEEETable) } func (d *digest) Size() int { return Size } +func (d *digest) BlockSize() int { return 1 } + func (d *digest) Reset() { d.crc = 0 } func update(crc uint32, tab *Table, p []byte) uint32 { diff --git a/libgo/go/hash/crc64/crc64.go b/libgo/go/hash/crc64/crc64.go index e5c1db4..5b64390 100644 --- a/libgo/go/hash/crc64/crc64.go +++ b/libgo/go/hash/crc64/crc64.go @@ -53,6 +53,8 @@ func New(tab *Table) hash.Hash64 { return &digest{0, tab} } func (d *digest) Size() int { return Size } +func (d *digest) BlockSize() int { return 1 } + func (d *digest) Reset() { d.crc = 0 } func update(crc uint64, tab *Table, p []byte) uint64 { diff --git a/libgo/go/hash/fnv/fnv.go b/libgo/go/hash/fnv/fnv.go index 2c8a251..ea50198 100644 --- a/libgo/go/hash/fnv/fnv.go +++ b/libgo/go/hash/fnv/fnv.go @@ -104,6 +104,11 @@ func (s *sum32a) Size() int { return 4 } func (s *sum64) Size() int { return 8 } func (s *sum64a) Size() int { return 8 } +func (s *sum32) BlockSize() int { return 1 } +func (s *sum32a) BlockSize() int { return 1 } +func (s *sum64) BlockSize() int { return 1 } +func (s *sum64a) BlockSize() int { return 1 } + func (s *sum32) Sum(in []byte) []byte { v := uint32(*s) in = append(in, byte(v>>24)) diff --git a/libgo/go/hash/hash.go b/libgo/go/hash/hash.go index 8598f4e..aa895cf 100644 --- a/libgo/go/hash/hash.go +++ b/libgo/go/hash/hash.go @@ -22,6 +22,12 @@ type Hash interface { // Size returns the number of bytes Sum will return. Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int } // Hash32 is the common interface implemented by all 32-bit hash functions. |