Added preprocessor token definitions. Also added corresponding ARM asm instructions...
authorchsieh <chester.developer@hotmail.com>
Sat, 18 Dec 2010 00:52:13 +0000 (16:52 -0800)
committerchsieh <chester.developer@hotmail.com>
Sat, 18 Dec 2010 00:52:13 +0000 (16:52 -0800)
Classes/Foundation/Common/GlobalDefines.h
Littlest.xcodeproj/project.pbxproj

index 58323d7..94b70ba 100755 (executable)
@@ -3,38 +3,40 @@
 #include "Foundation/Common/GlobalTypes.h"\r
 \r
 #ifdef _WINDOWS\r
-#define __WINDOWS__\r
+  #define __WINDOWS__\r
+#ifdef __iOS__\r
+  #define __ARM__\r
 #endif\r
 \r
 #ifdef _DEBUG\r
-#define DEBUG\r
+  #define DEBUG\r
 #endif\r
 \r
 #ifdef _NDEBUG\r
-#define RELEASE\r
+  #define RELEASE\r
 #endif\r
 \r
 #ifndef NULL\r
-#define NULL 0\r
+  #define NULL 0\r
 #endif\r
 \r
 #ifndef FALSE\r
-#define FALSE 0\r
+  #define FALSE 0\r
 #endif\r
 \r
 #ifndef TRUE\r
-#define TRUE 1\r
+  #define TRUE 1\r
 #endif\r
 \r
 //----------------------------------------------------------------------------------------\r
 // cache information\r
 #ifndef CACHE_LINE_SIZE\r
-#define CACHE_LINE_SIZE         128 //equal to 2 line for intel normally\r
+#define CACHE_LINE_SIZE         128 // normally equals to 2 lines for intel\r
 #endif\r
 \r
 //----------------------------------------------------------------------------------------\r
 //force inline on non-debug, might make code explode\r
-#ifdef _DEBUG\r
+#ifdef DEBUG\r
   #define slInline                inline\r
 #else\r
   #define slInline                __forceinline\r
@@ -49,6 +51,8 @@
 // alignment macros\r
 #if defined(__WINDOWS__)\r
 #define ALIGN(N)                  __declspec(align(N))\r
+#elif defined(__iOS__)\r
+#define ALIGN(N)                  __atribute__((aligned (N)))\r
 #endif\r
 \r
 #define IS_POWER_OF_TWO(x)        ( ((x) & -(x)) == (x) )\r
@@ -66,7 +70,7 @@
 #if defined(__WINDOWS__)\r
 // uhh, nothing?\r
 #elif defined(__ARM__)\r
-#define DCBT(x) __asm__("pld" #(x))\r
+#define DCBT(x) __asm__("pld %0" : : "r"((x)))\r
 #else\r
 #error Not implemented yet!\r
 #endif\r
@@ -95,6 +99,7 @@
 \r
 //----------------------------------------------------------------------------------------\r
 #if defined(__WINDOWS__)\r
+\r
 slInline uint8_t LZCount(uint64_t x)\r
 {\r
   uint8_t leading_zero_count = 0;\r
@@ -112,8 +117,18 @@ slInline uint8_t LZCount(uint64_t x)
 \r
   return leading_zero_count;\r
 }\r
+\r
+#elif defined(__ARM__)\r
+\r
+slInline uint8_t LZCount(uint64_t x)\r
+{\r
+  uint8_t result;\r
+  __asm__("clz %1 %0" : "=r" (result) : "r"(x));\r
+  return result;\r
+}\r
+\r
 #else\r
-#error // use lzcnt!\r
+#error use lzcnt!\r
 #endif\r
 \r
 //----------------------------------------------------------------------------------------\r
index d49746c..81661ef 100755 (executable)
                                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
                                GCC_CHAR_IS_UNSIGNED_CHAR = YES;
                                GCC_C_LANGUAGE_STANDARD = c99;
+                               GCC_ENABLE_CPP_EXCEPTIONS = NO;
+                               GCC_ENABLE_CPP_RTTI = NO;
                                GCC_FAST_MATH = YES;
                                GCC_ONE_BYTE_BOOL = NO;
-                               GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       __iOS__,
+                                       DEBUG,
+                               );
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                PREBINDING = NO;
                                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
                                GCC_CHAR_IS_UNSIGNED_CHAR = YES;
                                GCC_C_LANGUAGE_STANDARD = c99;
+                               GCC_ENABLE_CPP_EXCEPTIONS = NO;
+                               GCC_ENABLE_CPP_RTTI = NO;
                                GCC_FAST_MATH = YES;
                                GCC_ONE_BYTE_BOOL = NO;
+                               GCC_PREPROCESSOR_DEFINITIONS = __iOS__;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";