(v interface{})
| 412 | } |
| 413 | |
| 414 | func encodeFloat4(v interface{}) []byte { |
| 415 | buf := make([]byte, 4) |
| 416 | var f float32 |
| 417 | switch val := v.(type) { |
| 418 | case float32: |
| 419 | f = val |
| 420 | case float64: |
| 421 | f = float32(val) |
| 422 | case int: |
| 423 | f = float32(val) |
| 424 | case int32: |
| 425 | f = float32(val) |
| 426 | case int64: |
| 427 | f = float32(val) |
| 428 | default: |
| 429 | return nil |
| 430 | } |
| 431 | binary.BigEndian.PutUint32(buf, math.Float32bits(f)) |
| 432 | return buf |
| 433 | } |
| 434 | |
| 435 | func encodeFloat8(v interface{}) []byte { |
| 436 | buf := make([]byte, 8) |
no outgoing calls