8183570: Rework is_aligned_ to avoid multiple evaluation of the size expression
authorstefank
Wed, 05 Jul 2017 12:51:28 +0200
changeset 46642 ec1179442657
parent 46641 f64dc604ef8d
child 46645 1a4335135ffd
8183570: Rework is_aligned_ to avoid multiple evaluation of the size expression Reviewed-by: tschatzl, kbarrett
hotspot/src/share/vm/utilities/align.hpp
--- a/hotspot/src/share/vm/utilities/align.hpp	Fri Jul 07 16:49:45 2017 +0000
+++ b/hotspot/src/share/vm/utilities/align.hpp	Wed Jul 05 12:51:28 2017 +0200
@@ -44,7 +44,7 @@
 
 #define align_up_(size, alignment) (align_down_((size) + align_mask(alignment), (alignment)))
 
-#define is_aligned_(size, alignment) ((size) == (align_up_((size), (alignment))))
+#define is_aligned_(size, alignment) (((size) & align_mask(alignment)) == 0)
 
 // Temporary declaration until this file has been restructured.
 template <typename T>