diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-08-31 23:25:54 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-08-31 23:25:54 -0700 |
| commit | 69343c5951a7e6a6e272393c1946c12d635b51b8 (patch) | |
| tree | 634dfe70c1a02def0d314559eee987a38efddc52 /go/util | |
| parent | 57a4549d8678bb08f4ecbdede1939830471e3091 (diff) | |
| download | seaweedfs-69343c5951a7e6a6e272393c1946c12d635b51b8.tar.xz seaweedfs-69343c5951a7e6a6e272393c1946c12d635b51b8.zip | |
adding ttl field to volume super block
Diffstat (limited to 'go/util')
| -rw-r--r-- | go/util/bytes.go | 12 | ||||
| -rw-r--r-- | go/util/constants.go | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/go/util/bytes.go b/go/util/bytes.go index 6cc3d7018..dfa4ae665 100644 --- a/go/util/bytes.go +++ b/go/util/bytes.go @@ -1,5 +1,7 @@ package util +// big endian + func BytesToUint64(b []byte) (v uint64) { length := uint(len(b)) for i := uint(0); i < length-1; i++ { @@ -18,6 +20,12 @@ func BytesToUint32(b []byte) (v uint32) { v += uint32(b[length-1]) return } +func BytesToUint16(b []byte) (v uint16) { + v += uint16(b[0]) + v <<= 8 + v += uint16(b[1]) + return +} func Uint64toBytes(b []byte, v uint64) { for i := uint(0); i < 8; i++ { b[7-i] = byte(v >> (i * 8)) @@ -28,6 +36,10 @@ func Uint32toBytes(b []byte, v uint32) { b[3-i] = byte(v >> (i * 8)) } } +func Uint16toBytes(b []byte, v uint16) { + b[0] = byte(v >> 8) + b[1] = byte(v) +} func Uint8toBytes(b []byte, v uint8) { b[0] = byte(v) } diff --git a/go/util/constants.go b/go/util/constants.go index 196b4a405..f66930d62 100644 --- a/go/util/constants.go +++ b/go/util/constants.go @@ -3,5 +3,5 @@ package util import () const ( - VERSION = "0.63 beta" + VERSION = "0.63" ) |
