From c931fb704dca4d44908d1daeaa3e6058a0a39118 Mon Sep 17 00:00:00 2001 From: renthraysk Date: Sun, 12 Jan 2020 14:55:44 +0000 Subject: [PATCH] Switch to named return value for compress() saves copying. --- blake3.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blake3.go b/blake3.go index 90f6969..46fbc5a 100644 --- a/blake3.go +++ b/blake3.go @@ -83,8 +83,8 @@ type node struct { // node. When nodes are being merged into parents, only the first 8 words are // used. When the root node is being used to generate output, the full 16 words // are used. -func (n node) compress() [16]uint32 { - state := [16]uint32{ +func (n node) compress() (state [16]uint32) { + state = [16]uint32{ n.cv[0], n.cv[1], n.cv[2], n.cv[3], n.cv[4], n.cv[5], n.cv[6], n.cv[7], iv[0], iv[1], iv[2], iv[3], @@ -249,7 +249,7 @@ func (n node) compress() [16]uint32 { state[i] ^= state[i+8] state[i+8] ^= n.cv[i] } - return state + return } // chainingValue returns the first 8 words of the compressed node. This is used