avoid the "src" folder

This commit is contained in:
Chris Lu
2013-02-10 03:25:35 -08:00
parent 1b6f53cdac
commit ab6fb13ad7
51 changed files with 0 additions and 0 deletions

21
weed/storage/crc.go Normal file
View File

@@ -0,0 +1,21 @@
package storage
import (
"hash/crc32"
)
var table = crc32.MakeTable(crc32.Castagnoli)
type CRC uint32
func NewCRC(b []byte) CRC {
return CRC(0).Update(b)
}
func (c CRC) Update(b []byte) CRC {
return CRC(crc32.Update(uint32(c), table, b))
}
func (c CRC) Value() uint32 {
return uint32(c>>15|c<<17) + 0xa282ead8
}