(v interface{})
| 303 | } |
| 304 | |
| 305 | func encodeBool(v interface{}) []byte { |
| 306 | var b bool |
| 307 | switch val := v.(type) { |
| 308 | case bool: |
| 309 | b = val |
| 310 | case int, int8, int16, int32, int64: |
| 311 | b = val != 0 |
| 312 | default: |
| 313 | return []byte{0} |
| 314 | } |
| 315 | if b { |
| 316 | return []byte{1} |
| 317 | } |
| 318 | return []byte{0} |
| 319 | } |
| 320 | |
| 321 | func encodeInt2(v interface{}) []byte { |
| 322 | buf := make([]byte, 2) |
no outgoing calls