diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-14 18:30:13 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-07 14:49:44 +0100 |
commit | 41cd68416c8f35e80523fb3102b6a9c9982446c4 (patch) | |
tree | 643119e80c844893c01453d3f52bf36d50e55b0f /device/kdf_test.go | |
parent | 94b33ba705c75a6c02fc0567f0d6a776d4f03d07 (diff) |
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/kdf_test.go')
0 files changed, 0 insertions, 0 deletions