[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned
authorChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 01:31:49 +0000 (01:31 +0000)
committerChia-hung Duan <chiahungduan@google.com>
Wed, 15 Feb 2023 23:44:44 +0000 (23:44 +0000)
commita9269773eb94ddd36ec3e624740013ca3a5885ba
tree99ed168a307660e851d96743928137001977bafa
parent94a391b94972b68db03320f27ebf2e279051b3e6
[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned

The implementations of those functions require the rounding target to be
power-of-two. It's better to add a debugging check to avoid misuse.
Besides, add a general verion of those three to accommadate non
power-of-two cases.

Also change the name to roundUp/roundDown/isAligned

Reviewed By: cferris, cryptoad

Differential Revision: https://reviews.llvm.org/D142658
15 files changed:
compiler-rt/lib/scudo/standalone/chunk.h
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/common.h
compiler-rt/lib/scudo/standalone/primary32.h
compiler-rt/lib/scudo/standalone/primary64.h
compiler-rt/lib/scudo/standalone/release.h
compiler-rt/lib/scudo/standalone/secondary.h
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
compiler-rt/lib/scudo/standalone/tests/release_test.cpp
compiler-rt/lib/scudo/standalone/tests/secondary_test.cpp
compiler-rt/lib/scudo/standalone/trusty.cpp
compiler-rt/lib/scudo/standalone/vector.h
compiler-rt/lib/scudo/standalone/wrappers_c.inc
compiler-rt/lib/scudo/standalone/wrappers_c_checks.h