From 2afb59757268cc71e7780f683610b2724853cac0 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 13 May 2020 12:50:14 +0200 Subject: Fix T76665: Wrong files selected when using box select Reviewers: Severin Differential Revision: https://developer.blender.org/D7705 --- source/blender/blenlib/BLI_math_base.h | 1 + source/blender/blenlib/intern/math_base_inline.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index ae9617d2f16..e76c41970c6 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -33,6 +33,7 @@ #include "BLI_assert.h" #include "BLI_math_inline.h" +#include "BLI_sys_types.h" #include #ifndef M_PI diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index e0cac508d28..6db3ea819a4 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -355,6 +355,14 @@ MINLINE int divide_floor_i(int a, int b) return r ? d - ((a < 0) ^ (b < 0)) : d; } +/** + * Integer division that ceils the result, instead of flooring like normal C division. + */ +MINLINE uint divide_ceil_u(uint a, uint b) +{ + return (a + b - 1) / b; +} + /** * modulo that handles negative numbers, works the same as Python's. */ -- cgit v1.2.3