aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJammy Zhou2015-07-13 03:49:42 -0500
committerAlex Deucher2015-08-05 12:47:52 -0500
commit90e14d453ae8f08701e10c61264b53a233acfa3c (patch)
tree5f3490d34f2937469d51d3d9d36066e0213675c8 /util_math.h
parent95ecf91c7bb33a49093cfa2a19bc841c04b2707a (diff)
downloadexternal-libgbm-90e14d453ae8f08701e10c61264b53a233acfa3c.tar.gz
external-libgbm-90e14d453ae8f08701e10c61264b53a233acfa3c.tar.xz
external-libgbm-90e14d453ae8f08701e10c61264b53a233acfa3c.zip
drm: fix the ALIGN macro to avoid value clamp
If the value is 64bit, but the alignment is 32bit type, the high 32bit will be clamped with previous definition Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Christian K├Ânig <christian.koenig@amd.com>
Diffstat (limited to 'util_math.h')
-rw-r--r--util_math.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/util_math.h b/util_math.h
index b8de0f86..3bc5f644 100644
--- a/util_math.h
+++ b/util_math.h
@@ -27,6 +27,7 @@
27#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) 27#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
28#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) 28#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
29 29
30#define ALIGN( value, alignment ) ( ((value) + (alignment) - 1) & ~((alignment) - 1) ) 30#define __align_mask(value, mask) (((value) + (mask)) & ~(mask))
31#define ALIGN(value, alignment) __align_mask(value, (typeof(value))((alignment) - 1))
31 32
32#endif /*_UTIL_MATH_H_*/ 33#endif /*_UTIL_MATH_H_*/