diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2026-04-27 11:26:49 +0300 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2026-04-27 11:26:49 +0300 |
| commit | 0fc8f6200d2313278fbf4539bbab74677c685531 (patch) | |
| tree | 35f839d8e2244e0575cbdf60e8505048b5424885 /include/uapi/linux/const.h | |
| parent | d13e855ee923c2ae78307bf6c354305f1406b9e2 (diff) | |
| parent | 254f49634ee16a731174d2ae34bc50bd5f45e731 (diff) | |
| download | linux-0fc8f6200d2313278fbf4539bbab74677c685531.tar.xz | |
Merge drm/drm-fixes into drm-misc-fixes
Getting fixes and updates from v7.1-rc1.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'include/uapi/linux/const.h')
| -rw-r--r-- | include/uapi/linux/const.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h index b8f629ef135f..565f309b9df8 100644 --- a/include/uapi/linux/const.h +++ b/include/uapi/linux/const.h @@ -50,4 +50,22 @@ #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +/* + * Divide positive or negative dividend by positive or negative divisor + * and round to closest integer. Result is undefined for negative + * divisors if the dividend variable type is unsigned and for negative + * dividends if the divisor variable type is unsigned. + */ +#define __KERNEL_DIV_ROUND_CLOSEST(x, divisor) \ +({ \ + __typeof__(x) __x = x; \ + __typeof__(divisor) __d = divisor; \ + \ + (((__typeof__(x))-1) > 0 || \ + ((__typeof__(divisor))-1) > 0 || \ + (((__x) > 0) == ((__d) > 0))) ? \ + (((__x) + ((__d) / 2)) / (__d)) : \ + (((__x) - ((__d) / 2)) / (__d)); \ +}) + #endif /* _UAPI_LINUX_CONST_H */ |
