mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-04 20:09:03 +00:00
all: use Go 1.21's binary.NativeEndian
We still use josharian/native (hi @josharian!) via netlink, but I also sent https://github.com/mdlayher/netlink/pull/220 Updates #8632 Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
69b90742fe
commit
60d19fa00d
@@ -6,10 +6,9 @@
|
||||
package cstruct
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/josharian/native"
|
||||
)
|
||||
|
||||
// Size of a pointer-typed value, in bits
|
||||
@@ -120,7 +119,7 @@ func (d *Decoder) Uint16() uint16 {
|
||||
d.err = err
|
||||
return 0
|
||||
}
|
||||
return native.Endian.Uint16(d.dbuf[0:2])
|
||||
return binary.NativeEndian.Uint16(d.dbuf[0:2])
|
||||
}
|
||||
|
||||
// Uint32 returns a uint32 decoded from the buffer.
|
||||
@@ -133,7 +132,7 @@ func (d *Decoder) Uint32() uint32 {
|
||||
d.err = err
|
||||
return 0
|
||||
}
|
||||
return native.Endian.Uint32(d.dbuf[0:4])
|
||||
return binary.NativeEndian.Uint32(d.dbuf[0:4])
|
||||
}
|
||||
|
||||
// Uint64 returns a uint64 decoded from the buffer.
|
||||
@@ -146,7 +145,7 @@ func (d *Decoder) Uint64() uint64 {
|
||||
d.err = err
|
||||
return 0
|
||||
}
|
||||
return native.Endian.Uint64(d.dbuf[0:8])
|
||||
return binary.NativeEndian.Uint64(d.dbuf[0:8])
|
||||
}
|
||||
|
||||
// Uintptr returns a uintptr decoded from the buffer.
|
||||
|
||||
Reference in New Issue
Block a user