]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: clean up power-of-two rounding code with align functions
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 28 Jun 2019 16:44:07 +0000 (16:44 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 4 Nov 2019 23:41:34 +0000 (23:41 +0000)
commit383b447e0da5bd1fcdc2439230b5a1d3e3402117
treec1dafd5c18d1d2ddc09d51dc6892087e3f506411
parent2566e21f243387156e8e7f2acad0ce14d9712bbc
runtime: clean up power-of-two rounding code with align functions

This change renames the "round" function to the more appropriately named
"alignUp" which rounds an integer up to the next multiple of a power of
two.

This change also adds the alignDown function, which is almost like
alignUp but rounds down to the previous multiple of a power of two.

With these two functions, we also go and replace manual rounding code
with it where we can.

Change-Id: Ie1487366280484dcb2662972b01b4f7135f72fec
Reviewed-on: https://go-review.googlesource.com/c/go/+/190618
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/inl_test.go
src/runtime/malloc.go
src/runtime/mem_linux.go
src/runtime/mfinal.go
src/runtime/mheap.go
src/runtime/msize.go
src/runtime/race.go
src/runtime/stack.go
src/runtime/stubs.go
src/runtime/trace.go