summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJammy Zhou <Jammy.Zhou@amd.com>2015-07-13 16:49:42 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-07-30 00:11:13 -0400
commit0b6f6c4b4f0d4af0ed94cc85f25a8a667d882d9d (patch)
tree4572da86ae87f270dc98e535ce2069cca3220e9d
parentf690d969738c2e2e4340bf6d711fb9e6ef1c0f56 (diff)
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>
-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 @@
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
-#define ALIGN( value, alignment ) ( ((value) + (alignment) - 1) & ~((alignment) - 1) )
+#define __align_mask(value, mask) (((value) + (mask)) & ~(mask))
+#define ALIGN(value, alignment) __align_mask(value, (typeof(value))((alignment) - 1))
#endif /*_UTIL_MATH_H_*/