Bytes returns v's BSUP representation.
()
| 129 | |
| 130 | // Bytes returns v's BSUP representation. |
| 131 | func (v Value) Bytes() scode.Bytes { |
| 132 | if x, ok := v.native(); ok { |
| 133 | switch v.Type().ID() { |
| 134 | case IDUint8, IDUint16, IDUint32, IDUint64: |
| 135 | return EncodeUint(x) |
| 136 | case IDInt8, IDInt16, IDInt32, IDInt64, IDDuration, IDTime: |
| 137 | return EncodeInt(int64(x)) |
| 138 | case IDFloat16: |
| 139 | return EncodeFloat16(float32(math.Float64frombits(x))) |
| 140 | case IDFloat32: |
| 141 | return EncodeFloat32(float32(math.Float64frombits(x))) |
| 142 | case IDFloat64: |
| 143 | return EncodeFloat64(math.Float64frombits(x)) |
| 144 | case IDBool: |
| 145 | return EncodeBool(x != 0) |
| 146 | } |
| 147 | panic(v.Type()) |
| 148 | } |
| 149 | return v.bytes() |
| 150 | } |
| 151 | |
| 152 | func (v Value) IsContainer() bool { |
| 153 | return IsContainerType(v.Type()) |