diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2016-09-02 23:14:54 +0200 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-09-07 20:52:42 +0200 |
commit | 29fc9bb855cb878aee263cd1fe110e3bb3e98c80 (patch) | |
tree | ed7851f88b58378aa54afa56e755375da3684647 /src/soc/nvidia/tegra | |
parent | 614ffc60cfd667dae63492d14af2abd50ce91b3e (diff) | |
download | coreboot-29fc9bb855cb878aee263cd1fe110e3bb3e98c80.tar.xz |
commonlib: move DIV_ROUND macros from nvidia/tegra
DIV_ROUND_CLOSEST and DIV_ROUND_UP are useful macros for other
architectures. This patch moves them from soc/nvidia/tegra/types.h
to commonlib/include/commonlib/helpers.h .
Change-Id: I54521d9b197934cef8e352f9a5c4823015d85f01
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/16415
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/nvidia/tegra')
-rw-r--r-- | src/soc/nvidia/tegra/types.h | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/soc/nvidia/tegra/types.h b/src/soc/nvidia/tegra/types.h index dab474d35d..bfeebae2dc 100644 --- a/src/soc/nvidia/tegra/types.h +++ b/src/soc/nvidia/tegra/types.h @@ -51,22 +51,4 @@ (type *)( (char *)__mptr - offsetof(type,member) );}) #endif -#define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) - -/* - * Divide positive or negative dividend by positive divisor and round - * to closest integer. Result is undefined for negative divisors and - * for negative dividends if the divisor variable type is unsigned. - */ -#define DIV_ROUND_CLOSEST(x, divisor)( \ -{ \ - typeof(x) __x = x; \ - typeof(divisor) __d = divisor; \ - (((typeof(x))-1) > 0 || \ - ((typeof(divisor))-1) > 0 || (__x) > 0) ? \ - (((__x) + ((__d) / 2)) / (__d)) : \ - (((__x) - ((__d) / 2)) / (__d)); \ -} \ -) - #endif /* __TEGRA_MISC_TYPES_H__ */ |