aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/floatmarsh.go
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2024-05-11 06:59:46 +0000
committerGopher Robot <gobot@golang.org>2024-05-13 21:31:58 +0000
commit509bbeb407f58d06a8680b48a7f02f530d67f088 (patch)
tree51f062ccc1e4e07849c3c5b100cbe5b0e14e6a68 /src/math/big/floatmarsh.go
parent7e196c04ed9e670e1eae0a7477efb53c3938839c (diff)
downloadgo-509bbeb407f58d06a8680b48a7f02f530d67f088.tar.xz
math/rand/v2, math/big: use internal/byteorder
Change-Id: Id07f16d14133ee539bc2880b39641c42418fa6e2 GitHub-Last-Rev: 7b327d508f677f2476d24f046d25921f4599dd9a GitHub-Pull-Request: golang/go#67319 Reviewed-on: https://go-review.googlesource.com/c/go/+/585016 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/math/big/floatmarsh.go')
-rw-r--r--src/math/big/floatmarsh.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/math/big/floatmarsh.go b/src/math/big/floatmarsh.go
index 8a908cef28..16be946971 100644
--- a/src/math/big/floatmarsh.go
+++ b/src/math/big/floatmarsh.go
@@ -7,9 +7,9 @@
package big
import (
- "encoding/binary"
"errors"
"fmt"
+ "internal/byteorder"
)
// Gob codec version. Permits backward-compatible changes to the encoding.
@@ -48,10 +48,10 @@ func (x *Float) GobEncode() ([]byte, error) {
b |= 1
}
buf[1] = b
- binary.BigEndian.PutUint32(buf[2:], x.prec)
+ byteorder.BePutUint32(buf[2:], x.prec)
if x.form == finite {
- binary.BigEndian.PutUint32(buf[6:], uint32(x.exp))
+ byteorder.BePutUint32(buf[6:], uint32(x.exp))
x.mant[len(x.mant)-n:].bytes(buf[10:]) // cut off unused trailing words
}
@@ -84,13 +84,13 @@ func (z *Float) GobDecode(buf []byte) error {
z.acc = Accuracy((b>>3)&3) - 1
z.form = form((b >> 1) & 3)
z.neg = b&1 != 0
- z.prec = binary.BigEndian.Uint32(buf[2:])
+ z.prec = byteorder.BeUint32(buf[2:])
if z.form == finite {
if len(buf) < 10 {
return errors.New("Float.GobDecode: buffer too small for finite form float")
}
- z.exp = int32(binary.BigEndian.Uint32(buf[6:]))
+ z.exp = int32(byteorder.BeUint32(buf[6:]))
z.mant = z.mant.setBytes(buf[10:])
}