Bumps [github.com/shamaton/msgpack/v2](https://github.com/shamaton/msgpack) from 2.3.0 to 2.3.1. - [Release notes](https://github.com/shamaton/msgpack/releases) - [Commits](https://github.com/shamaton/msgpack/compare/v2.3.0...v2.3.1) --- updated-dependencies: - dependency-name: github.com/shamaton/msgpack/v2 dependency-version: 2.3.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
32 lines
889 B
Go
32 lines
889 B
Go
package encoding
|
|
|
|
import (
|
|
"math"
|
|
|
|
"github.com/shamaton/msgpack/v2/def"
|
|
)
|
|
|
|
func (e *encoder) calcComplex64() int {
|
|
return def.Byte1 + def.Byte1 + def.Byte8
|
|
}
|
|
|
|
func (e *encoder) calcComplex128() int {
|
|
return def.Byte1 + def.Byte1 + def.Byte16
|
|
}
|
|
|
|
func (e *encoder) writeComplex64(v complex64, offset int) int {
|
|
offset = e.setByte1Int(def.Fixext8, offset)
|
|
offset = e.setByte1Int(int(def.ComplexTypeCode()), offset)
|
|
offset = e.setByte4Uint64(uint64(math.Float32bits(real(v))), offset)
|
|
offset = e.setByte4Uint64(uint64(math.Float32bits(imag(v))), offset)
|
|
return offset
|
|
}
|
|
|
|
func (e *encoder) writeComplex128(v complex128, offset int) int {
|
|
offset = e.setByte1Int(def.Fixext16, offset)
|
|
offset = e.setByte1Int(int(def.ComplexTypeCode()), offset)
|
|
offset = e.setByte8Uint64(math.Float64bits(real(v)), offset)
|
|
offset = e.setByte8Uint64(math.Float64bits(imag(v)), offset)
|
|
return offset
|
|
}
|