pkg/math/bits: avoid an extra allocation per call
These functions implement builtins. In the process of converting their
arguments from CUE values to Go values, we already allocate bit.Ints;
hence, it's fine to reuse the first argument to store the result,
because we don't need to keep the first argument around.
If keeping the original value is needed by a caller in the future,
it's always possible to make a copy of it before the call.
│ old │ new │
│ B/op │ B/op vs base │
VetInventory 4.601Gi ± ∞ ¹ 4.593Gi ± ∞ ¹ -0.18% (p=1.000 n=1)
│ old │ new │
│ allocs/op │ allocs/op vs base │
VetInventory 48.33M ± ∞ ¹ 47.92M ± ∞ ¹ -0.85% (p=1.000 n=1)
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I6cf680cfae31732985900e25abd05c778ed01f34
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1229640
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>