diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-14 18:30:13 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-15 18:11:55 +0100 |
commit | 74008520cdd9abe83033bc78a1f588f843b89eba (patch) | |
tree | 643119e80c844893c01453d3f52bf36d50e55b0f /device/device.go | |
parent | ae6b17f7595e3d425f7b63e470d159327018ef04 (diff) | |
download | wireguard-go-74008520cdd9abe83033bc78a1f588f843b89eba.tar.gz wireguard-go-74008520cdd9abe83033bc78a1f588f843b89eba.zip |
device: simplify copying counter to nonce
Since we already have it packed into a uint64
in a known byte order, write it back out again
the same byte order instead of copying byte by byte.
This should also generate more efficient code,
because the compiler can do a single uint64 write,
instead of eight bounds checks and eight byte writes.
Due to a missed optimization, it actually generates a mishmash
of smaller writes: 1 byte, 4 bytes, 2 bytes, 1 byte.
This is https://golang.org/issue/41663.
The code is still better than before, and will get better yet
once that compiler bug gets fixed.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/device.go')
0 files changed, 0 insertions, 0 deletions