[Beignet] [PATCH 1/2] Change the KB and MB define to enum.

Yang Rong rong.r.yang at intel.com
Tue Feb 10 22:56:59 PST 2015


Using the enum to avoid name conflict.

Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 backend/src/sys/platform.hpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/backend/src/sys/platform.hpp b/backend/src/sys/platform.hpp
index e7aeee6..173b880 100644
--- a/backend/src/sys/platform.hpp
+++ b/backend/src/sys/platform.hpp
@@ -258,10 +258,14 @@ private: \
 /*! Default alignment for the platform */
 #define GBE_DEFAULT_ALIGNMENT 16
 
+namespace gbe
+{
 /*! Useful constants */
-#define KB 1024
-#define MB (KB*KB)
-
+  enum {
+    KB = 1024,
+    MB = (KB*KB),
+  };
+}
 /*! Portable AlignOf */
 template <typename T>
 struct AlignOf {
-- 
1.8.3.2



More information about the Beignet mailing list