MCPcopy Create free account
hub / github.com/dotabuff/manta / decode

Method decode

quantizedfloat.go:130–144  ·  view source on GitHub ↗

Actual float decoding

(r *reader)

Source from the content-addressed store, hash-verified

128
129// Actual float decoding
130func (qfd *quantizedFloatDecoder) decode(r *reader) float32 {
131 if (qfd.Flags&qff_rounddown) != 0 && r.readBoolean() {
132 return qfd.Low
133 }
134
135 if (qfd.Flags&qff_roundup) != 0 && r.readBoolean() {
136 return qfd.High
137 }
138
139 if (qfd.Flags&qff_encode_zero) != 0 && r.readBoolean() {
140 return 0.0
141 }
142
143 return qfd.Low + (qfd.High-qfd.Low)*float32(r.readBits(qfd.Bitcount))*qfd.DecMul
144}
145
146// Creates a new quantized float decoder based on given field
147func newQuantizedFloatDecoder(bitCount, flags *int32, lowValue, highValue *float32) *quantizedFloatDecoder {

Callers 1

quantizedFactoryFunction · 0.80

Calls 2

readBooleanMethod · 0.80
readBitsMethod · 0.80

Tested by

no test coverage detected