From: Sergey Matveev Date: Tue, 14 Jan 2025 10:19:54 +0000 (+0300) Subject: Simplify ≥0 check X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=67e43f3175a1e33548442f1c6292d339bc39f12e12055d2b0060256243221b39;p=keks.git Simplify ≥0 check --- diff --git a/go/atom-encode.go b/go/atom-encode.go index 485d9b4..4c5876a 100644 --- a/go/atom-encode.go +++ b/go/atom-encode.go @@ -97,7 +97,7 @@ func IntEncode(w io.Writer, v int64) (written int64, err error) { // Write an encoded ±INT atom. func BigIntEncode(w io.Writer, v *big.Int) (written int64, err error) { - if v.Cmp(bigIntZero) >= 0 { + if v.Sign() >= 0 { _, err = w.Write([]byte{byte(AtomPInt)}) } else { n1 := big.NewInt(-1) diff --git a/go/encode.go b/go/encode.go index cd478f1..2f9cf01 100644 --- a/go/encode.go +++ b/go/encode.go @@ -31,8 +31,6 @@ import ( "go.cypherpunks.su/tai64n/v4" ) -var bigIntZero = big.NewInt(0) - type EncodeOpts struct { // Do not convert time.Time to TAI, assume no conversion is needed. LeaveTAI bool