Actual float decoding
(r *reader)
| 128 | |
| 129 | // Actual float decoding |
| 130 | func (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 |
| 147 | func newQuantizedFloatDecoder(bitCount, flags *int32, lowValue, highValue *float32) *quantizedFloatDecoder { |
no test coverage detected