diff options
| author | yourchanges <yourchanges@gmail.com> | 2014-10-21 15:50:48 +0800 |
|---|---|---|
| committer | yourchanges <yourchanges@gmail.com> | 2014-10-21 15:50:48 +0800 |
| commit | f7bcd8e958ef185baeca0c455a397d49fcb62256 (patch) | |
| tree | bb2a2de4fcb7f9ac7e1d65a78e82cbe1f5f17e36 /go/util | |
| parent | 78ccbbf3d0766e1ececf91fa00766d1ed33050cc (diff) | |
| parent | a3c17f17b144c4298409fddda2d6bc4b39d38ca5 (diff) | |
| download | seaweedfs-f7bcd8e958ef185baeca0c455a397d49fcb62256.tar.xz seaweedfs-f7bcd8e958ef185baeca0c455a397d49fcb62256.zip | |
Merge pull request #1 from chrislusf/master
update
Diffstat (limited to 'go/util')
| -rw-r--r-- | go/util/bytes.go | 12 | ||||
| -rw-r--r-- | go/util/config.go | 2 | ||||
| -rw-r--r-- | go/util/constants.go | 2 | ||||
| -rw-r--r-- | go/util/file_util.go | 2 | ||||
| -rw-r--r-- | go/util/net_timeout.go | 2 |
5 files changed, 16 insertions, 4 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/config.go b/go/util/config.go index 9a1ac680b..050fd0e64 100644 --- a/go/util/config.go +++ b/go/util/config.go @@ -10,7 +10,7 @@ package util import ( "bytes" - "code.google.com/p/weed-fs/go/glog" + "github.com/chrislusf/weed-fs/go/glog" "encoding/json" "os" ) diff --git a/go/util/constants.go b/go/util/constants.go index 196b4a405..db1ca38e5 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.64" ) diff --git a/go/util/file_util.go b/go/util/file_util.go index 9f3354011..412d98458 100644 --- a/go/util/file_util.go +++ b/go/util/file_util.go @@ -2,7 +2,7 @@ package util import ( "bufio" - "code.google.com/p/weed-fs/go/glog" + "github.com/chrislusf/weed-fs/go/glog" "errors" "os" ) diff --git a/go/util/net_timeout.go b/go/util/net_timeout.go index a6cc81c99..eb80822b5 100644 --- a/go/util/net_timeout.go +++ b/go/util/net_timeout.go @@ -1,7 +1,7 @@ package util import ( - "code.google.com/p/weed-fs/go/stats" + "github.com/chrislusf/weed-fs/go/stats" "net" "time" ) |
