summaryrefslogtreecommitdiffstats
path: root/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go
diff options
context:
space:
mode:
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go')
-rw-r--r--llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go26
1 files changed, 5 insertions, 21 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go b/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go
index 466bf97c973..2bbe07c02ff 100644
--- a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go
+++ b/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go
@@ -13,7 +13,7 @@
// The varint functions encode and decode single integer values using
// a variable-length encoding; smaller values require fewer bytes.
// For a specification, see
-// http://code.google.com/apis/protocolbuffers/docs/encoding.html.
+// https://developers.google.com/protocol-buffers/docs/encoding.
//
// This package favors simplicity over efficiency. Clients that require
// high-performance serialization, especially for large data structures,
@@ -239,78 +239,62 @@ func Write(w io.Writer, order ByteOrder, data interface{}) error {
}
switch v := data.(type) {
case *int8:
- bs = b[:1]
b[0] = byte(*v)
case int8:
- bs = b[:1]
b[0] = byte(v)
case []int8:
for i, x := range v {
bs[i] = byte(x)
}
case *uint8:
- bs = b[:1]
b[0] = *v
case uint8:
- bs = b[:1]
b[0] = byte(v)
case []uint8:
bs = v
case *int16:
- bs = b[:2]
order.PutUint16(bs, uint16(*v))
case int16:
- bs = b[:2]
order.PutUint16(bs, uint16(v))
case []int16:
for i, x := range v {
order.PutUint16(bs[2*i:], uint16(x))
}
case *uint16:
- bs = b[:2]
order.PutUint16(bs, *v)
case uint16:
- bs = b[:2]
order.PutUint16(bs, v)
case []uint16:
for i, x := range v {
order.PutUint16(bs[2*i:], x)
}
case *int32:
- bs = b[:4]
order.PutUint32(bs, uint32(*v))
case int32:
- bs = b[:4]
order.PutUint32(bs, uint32(v))
case []int32:
for i, x := range v {
order.PutUint32(bs[4*i:], uint32(x))
}
case *uint32:
- bs = b[:4]
order.PutUint32(bs, *v)
case uint32:
- bs = b[:4]
order.PutUint32(bs, v)
case []uint32:
for i, x := range v {
order.PutUint32(bs[4*i:], x)
}
case *int64:
- bs = b[:8]
order.PutUint64(bs, uint64(*v))
case int64:
- bs = b[:8]
order.PutUint64(bs, uint64(v))
case []int64:
for i, x := range v {
order.PutUint64(bs[8*i:], uint64(x))
}
case *uint64:
- bs = b[:8]
order.PutUint64(bs, *v)
case uint64:
- bs = b[:8]
order.PutUint64(bs, v)
case []uint64:
for i, x := range v {
@@ -605,25 +589,25 @@ func (e *encoder) skip(v reflect.Value) {
// It returns zero if the type cannot be implemented by the fast path in Read or Write.
func intDataSize(data interface{}) int {
switch data := data.(type) {
- case int8, *int8, *uint8:
+ case int8, uint8, *int8, *uint8:
return 1
case []int8:
return len(data)
case []uint8:
return len(data)
- case int16, *int16, *uint16:
+ case int16, uint16, *int16, *uint16:
return 2
case []int16:
return 2 * len(data)
case []uint16:
return 2 * len(data)
- case int32, *int32, *uint32:
+ case int32, uint32, *int32, *uint32:
return 4
case []int32:
return 4 * len(data)
case []uint32:
return 4 * len(data)
- case int64, *int64, *uint64:
+ case int64, uint64, *int64, *uint64:
return 8
case []int64:
return 8 * len(data)
OpenPOWER on IntegriCloud