ReadComplex64Bytes reads a complex64 extension object from 'b' and returns the remaining bytes. Possible errors: - [ErrShortBytes] (not enough bytes in 'b') - [TypeError] (object not a complex64) - [ExtensionTypeError] (object an extension of the correct size, but not a complex64)
(b []byte)
| 1048 | // - [TypeError] (object not a complex64) |
| 1049 | // - [ExtensionTypeError] (object an extension of the correct size, but not a complex64) |
| 1050 | func ReadComplex64Bytes(b []byte) (c complex64, o []byte, err error) { |
| 1051 | if len(b) < 10 { |
| 1052 | err = ErrShortBytes |
| 1053 | return |
| 1054 | } |
| 1055 | if b[0] != mfixext8 { |
| 1056 | err = badPrefix(Complex64Type, b[0]) |
| 1057 | return |
| 1058 | } |
| 1059 | if b[1] != Complex64Extension { |
| 1060 | err = errExt(int8(b[1]), Complex64Extension) |
| 1061 | return |
| 1062 | } |
| 1063 | c = complex(math.Float32frombits(big.Uint32(b[2:])), |
| 1064 | math.Float32frombits(big.Uint32(b[6:]))) |
| 1065 | o = b[10:] |
| 1066 | return |
| 1067 | } |
| 1068 | |
| 1069 | // ReadTimeUTCBytes does the same as ReadTimeBytes, but returns the value as UTC. |
| 1070 | func ReadTimeUTCBytes(b []byte) (t time.Time, o []byte, err error) { |
searching dependent graphs…