mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +08:00
This commit is contained in:
1 parent
60eb5ac6a1
commit
be697e7045
10 files changed
+508
-220
No files matched your search
+5
-1
@@ -742,8 +742,12 @@ func encodeType2Number(target *bytes.Buffer, value float64) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
fixed := math.Round(value * 65536)
|
||||
if fixed < math.MinInt32 || fixed > math.MaxInt32 {
|
||||
return fmt.Errorf("Type2 fixed operand out of range")
|
||||
}
|
||||
target.WriteByte(255)
|
||||
_ = binary.Write(target, binary.BigEndian, int32(math.Round(value*65536)))
|
||||
_ = binary.Write(target, binary.BigEndian, int32(fixed))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user