diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-30 01:19:33 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-30 01:19:33 -0700 |
| commit | 50a5018b7fb259cee84471ce8d7bb6e554602c61 (patch) | |
| tree | 9c90e316fe1b7b06e3c0319a8723b85b84518a95 /weed/util/bytes.go | |
| parent | 9dc0b1df8f3bb19ce01b2d520436dbdc0f2a883e (diff) | |
| download | seaweedfs-50a5018b7fb259cee84471ce8d7bb6e554602c61.tar.xz seaweedfs-50a5018b7fb259cee84471ce8d7bb6e554602c61.zip | |
writing meta logs is working
Diffstat (limited to 'weed/util/bytes.go')
| -rw-r--r-- | weed/util/bytes.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/weed/util/bytes.go b/weed/util/bytes.go index 9c7e5e2cb..d9e462693 100644 --- a/weed/util/bytes.go +++ b/weed/util/bytes.go @@ -74,3 +74,20 @@ func HashStringToLong(dir string) (v int64) { return } + +func HashToInt32(data []byte) (v int32) { + h := md5.New() + h.Write(data) + + b := h.Sum(nil) + + v += int32(b[0]) + v <<= 8 + v += int32(b[1]) + v <<= 8 + v += int32(b[2]) + v <<= 8 + v += int32(b[3]) + + return +} |
