diff --git a/include/bx/bx.h b/include/bx/bx.h index 80e9b76..c9419b3 100644 --- a/include/bx/bx.h +++ b/include/bx/bx.h @@ -82,6 +82,6 @@ namespace bx } // namespace bx // Annoying C++0x stuff.. -namespace std { namespace tr1 {}; using namespace tr1; } +//namespace std { namespace tr1 {}; using namespace tr1; } #endif // BX_H_HEADER_GUARD diff --git a/include/bx/handlealloc.h b/include/bx/handlealloc.h index 2a05f21..0f63ee5 100644 --- a/include/bx/handlealloc.h +++ b/include/bx/handlealloc.h @@ -452,8 +452,8 @@ namespace bx } const KeyT hash = mix(_key); - const uint32_t first = hash % MaxCapacityT; - uint32_t idx = first; + const uint32_t firstIdx = hash % MaxCapacityT; + uint32_t idx = firstIdx; do { if (m_handle[idx] == invalid) @@ -471,7 +471,7 @@ namespace bx idx = (idx + 1) % MaxCapacityT; - } while (idx != first); + } while (idx != firstIdx); return false; } @@ -577,8 +577,8 @@ namespace bx { const KeyT hash = mix(_key); - const uint32_t first = hash % MaxCapacityT; - uint32_t idx = first; + const uint32_t firstIdx = hash % MaxCapacityT; + uint32_t idx = firstIdx; do { if (m_handle[idx] == invalid) @@ -593,7 +593,7 @@ namespace bx idx = (idx + 1) % MaxCapacityT; - } while (idx != first); + } while (idx != firstIdx); return UINT32_MAX; } diff --git a/include/bx/string.h b/include/bx/string.h index df837a3..ea21ff3 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -43,9 +43,8 @@ namespace bx /// inline size_t strnlen(const char* _str, size_t _max) { - const char* end = _str + _max; const char* ptr; - for (ptr = _str; ptr < end && *ptr != '\0'; ++ptr) {}; + for (ptr = _str; 0 < _max && *ptr != '\0'; ++ptr, --_max) {}; return ptr - _str; } diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 59795b2..9b608a5 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -26,6 +26,7 @@ function toolchain(_buildDir, _libDir) { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, { "ios-arm", "iOS - ARM" }, + { "ios-arm64", "iOS - ARM64" }, { "ios-simulator", "iOS - Simulator" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, @@ -195,11 +196,12 @@ function toolchain(_buildDir, _libDir) elseif "freebsd" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-freebsd")) - elseif "ios-arm" == _OPTIONS["gcc"] then + elseif "ios-arm" == _OPTIONS["gcc"] + or "ios-arm64" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm")) + location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"])) elseif "ios-simulator" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" @@ -485,6 +487,11 @@ function toolchain(_buildDir, _libDir) "__STDC_CONSTANT_MACROS", } + configuration { "qbs" } + flags { + "ExtraWarnings", + } + configuration { "Debug" } targetsuffix "Debug" @@ -1056,8 +1063,26 @@ function toolchain(_buildDir, _libDir) objdir (path.join(_buildDir, "ios-arm/obj")) libdirs { path.join(_libDir, "lib/ios-arm") } linkoptions { - "-miphoneos-version-min=7.0", "-arch armv7", + } + buildoptions { + "-arch armv7", + } + + configuration { "ios-arm64" } + targetdir (path.join(_buildDir, "ios-arm64/bin")) + objdir (path.join(_buildDir, "ios-arm64/obj")) + libdirs { path.join(_libDir, "lib/ios-arm64") } + linkoptions { + "-arch arm64", + } + buildoptions { + "-arch arm64", + } + + configuration { "ios-arm*" } + linkoptions { + "-miphoneos-version-min=7.0", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks", @@ -1065,7 +1090,6 @@ function toolchain(_buildDir, _libDir) } buildoptions { "-miphoneos-version-min=7.0", - "-arch armv7", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk", } diff --git a/tests/string_test.cpp b/tests/string_test.cpp index 390a75b..3d98e38 100644 --- a/tests/string_test.cpp +++ b/tests/string_test.cpp @@ -10,6 +10,15 @@ bx::AllocatorI* g_allocator; +TEST_CASE("strnlen", "") +{ + const char* test = "test"; + + REQUIRE(0 == bx::strnlen(test, 0) ); + REQUIRE(2 == bx::strnlen(test, 2) ); + REQUIRE(4 == bx::strnlen(test, UINT32_MAX) ); +} + TEST_CASE("StringView", "") { bx::StringView sv("test"); diff --git a/tools/bin/darwin/genie b/tools/bin/darwin/genie index 8b713d3..72355cf 100755 Binary files a/tools/bin/darwin/genie and b/tools/bin/darwin/genie differ diff --git a/tools/bin/linux/genie b/tools/bin/linux/genie index 862ce89..fcf5b28 100755 Binary files a/tools/bin/linux/genie and b/tools/bin/linux/genie differ diff --git a/tools/bin/windows/genie.exe b/tools/bin/windows/genie.exe index 486fa4c..8a5db3c 100644 Binary files a/tools/bin/windows/genie.exe and b/tools/bin/windows/genie.exe differ