mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
stdlib.h: drop DIV_ROUND_CLOSEST
It's already available in commonlib/helpers.h BUG=none BRANCH=none TEST=things still build Change-Id: Ib6e3eff82eb4fe6f3aef2065f5c2f7ada11e9e25 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/427820 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
This commit is contained in:
parent
706d0b86c7
commit
32a6d626ba
1 changed files with 0 additions and 16 deletions
|
@ -16,22 +16,6 @@ static inline unsigned long div_round_up(unsigned int n, unsigned int d)
|
|||
{
|
||||
return (n + d - 1) / d;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue