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:
Patrick Georgi 2017-01-12 19:59:09 +01:00 committed by chrome-bot
parent 706d0b86c7
commit 32a6d626ba

View file

@ -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