]> git.baikalelectronics.ru Git - arm-tf.git/commit
Make div_round_up() correct for divisors that are not a power of 2
authorJulius Werner <jwerner@chromium.org>
Mon, 22 Jan 2018 21:56:13 +0000 (13:56 -0800)
committerJulius Werner <jwerner@chromium.org>
Mon, 22 Jan 2018 21:56:13 +0000 (13:56 -0800)
commit7baa7bcaf58b7fe89aab6e5e7c0f46cc4adc2b93
tree1e77158bf1d485923e828990a4b90caba7926299
parent211d307c6bfadbe44aa27998e105436143e1b147
Make div_round_up() correct for divisors that are not a power of 2

The current div_round_up() implementation relies on round_up() which
only works correctly for boundaries that are a power of 2. It is
documented as such, but this still seems dangerously easy to overlook,
especially since many other environments (e.g. the Linux kernel) have a
similar macro without these limitations.

There is a different way to calculate this that can deal with all kinds
of divisors without other drawbacks, so let's just use that instead.

Change-Id: Id382736683f5d4e880ef00c53cfa23a2f9208440
Signed-off-by: Julius Werner <jwerner@chromium.org>
include/lib/utils_def.h