aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/msize.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2019-06-28 16:44:07 +0000
committerMichael Knyszek <mknyszek@google.com>2019-11-04 23:41:34 +0000
commit383b447e0da5bd1fcdc2439230b5a1d3e3402117 (patch)
treec1dafd5c18d1d2ddc09d51dc6892087e3f506411 /src/runtime/msize.go
parent2566e21f243387156e8e7f2acad0ce14d9712bbc (diff)
downloadgo-383b447e0da5bd1fcdc2439230b5a1d3e3402117.tar.gz
go-383b447e0da5bd1fcdc2439230b5a1d3e3402117.zip
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>
Diffstat (limited to 'src/runtime/msize.go')
-rw-r--r--src/runtime/msize.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/msize.go b/src/runtime/msize.go
index 0accb83eb8..11d06ce025 100644
--- a/src/runtime/msize.go
+++ b/src/runtime/msize.go
@@ -21,5 +21,5 @@ func roundupsize(size uintptr) uintptr {
if size+_PageSize < size {
return size
}
- return round(size, _PageSize)
+ return alignUp(size, _PageSize)
}