Browse Source

Disable BX_CRT_NONE detection.

Branimir Karadžić 8 years ago
parent
commit
878883f568
2 changed files with 13 additions and 12 deletions
  1. 3 11
      include/bx/platform.h
  2. 10 1
      src/crt.cpp

+ 3 - 11
include/bx/platform.h

@@ -29,12 +29,13 @@
 #define BX_CPU_X86   0
 #define BX_CPU_X86   0
 
 
 // C Runtime
 // C Runtime
-#define BX_CRT_MSVC   0
 #define BX_CRT_GLIBC  0
 #define BX_CRT_GLIBC  0
 #define BX_CRT_LIBCXX 0
 #define BX_CRT_LIBCXX 0
-#define BX_CRT_NEWLIB 0
 #define BX_CRT_MINGW  0
 #define BX_CRT_MINGW  0
+#define BX_CRT_MSVC   0
 #define BX_CRT_MUSL   0
 #define BX_CRT_MUSL   0
+#define BX_CRT_NEWLIB 0
+#define BX_CRT_NONE   0
 
 
 // Platform
 // Platform
 #define BX_PLATFORM_ANDROID    0
 #define BX_PLATFORM_ANDROID    0
@@ -254,15 +255,6 @@
 		|| BX_PLATFORM_RPI        \
 		|| BX_PLATFORM_RPI        \
 		)
 		)
 
 
-#define BX_CRT_NONE !(0  \
-		|| BX_CRT_MSVC   \
-		|| BX_CRT_GLIBC  \
-		|| BX_CRT_LIBCXX \
-		|| BX_CRT_NEWLIB \
-		|| BX_CRT_MINGW  \
-		|| BX_CRT_MUSL   \
-		)
-
 #ifndef  BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
 #ifndef  BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
 #	define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
 #	define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
 #endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
 #endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS

+ 10 - 1
src/crt.cpp

@@ -121,7 +121,7 @@ namespace bx
 #endif // BX_CRT_NONE
 #endif // BX_CRT_NONE
 	}
 	}
 
 
-	int32_t memCmp(const char* _lhs, const char* _rhs, size_t _numBytes)
+	int32_t memCmpRef(const char* _lhs, const char* _rhs, size_t _numBytes)
 	{
 	{
 		for (
 		for (
 			; 0 < _numBytes && *_lhs == *_rhs
 			; 0 < _numBytes && *_lhs == *_rhs
@@ -133,6 +133,15 @@ namespace bx
 		return 0 == _numBytes ? 0 : *_lhs - *_rhs;
 		return 0 == _numBytes ? 0 : *_lhs - *_rhs;
 	}
 	}
 
 
+	int32_t memCmp(const char* _lhs, const char* _rhs, size_t _numBytes)
+	{
+#if BX_CRT_NONE
+		return memCmpRef(_lhs, _rhs, _numBytes);
+#else
+		return ::memcmp(_lhs, _rhs, _numBytes);
+#endif // BX_CRT_NONE
+	}
+
 	namespace
 	namespace
 	{
 	{
 		struct Param
 		struct Param