Browse Source

Clang: Fixed bx::signbit.

Бранимир Караџић 2 years ago
parent
commit
ac1b473832
2 changed files with 9 additions and 8 deletions
  1. 2 1
      include/bx/inline/math.inl
  2. 7 7
      tests/string_test.cpp

+ 2 - 1
include/bx/inline/math.inl

@@ -143,7 +143,8 @@ namespace bx
 #if BX_COMPILER_MSVC
 		return _signbit(_a);
 #else
-		return __builtin_signbit(_a);
+		return copysign(1, _a) < 0;
+//		return __builtin_signbit(_a);
 #endif // BX_COMPILER_MSVC
 	}
 

+ 7 - 7
tests/string_test.cpp

@@ -18,29 +18,29 @@ TEST_CASE("StringLiteral", "")
 
 	REQUIRE(bx::isSorted(tmp, BX_COUNTOF(tmp) ) );
 
-	static_assert(4 == tmp[0].getLength() );
+	STATIC_REQUIRE(4 == tmp[0].getLength() );
 	REQUIRE(4 == bx::strLen(tmp[0]) );
 	REQUIRE(0 == bx::strCmp("1389", tmp[0]) );
 
-	static_assert(5 == tmp[1].getLength() );
+	STATIC_REQUIRE(5 == tmp[1].getLength() );
 	REQUIRE(5 == bx::strLen(tmp[1]) );
 	REQUIRE(0 == bx::strCmp("abvgd", tmp[1]) );
 
-	static_assert(3 == tmp[2].getLength() );
+	STATIC_REQUIRE(3 == tmp[2].getLength() );
 	REQUIRE(3 == bx::strLen(tmp[2]) );
 	REQUIRE(0 == bx::strCmp("mac", tmp[2]) );
 
-	static_assert(3 == tmp[3].getLength() );
+	STATIC_REQUIRE(3 == tmp[3].getLength() );
 	REQUIRE(3 == bx::strLen(tmp[3]) );
 	REQUIRE(0 == bx::strCmp("pod", tmp[3]) );
 
-	constexpr bx::StringLiteral copy = tmp[0];
+	constexpr bx::StringLiteral copy(tmp[0]);
 
-	static_assert(4 == copy.getLength() );
+	STATIC_REQUIRE(4 == copy.getLength() );
 	REQUIRE(4 == bx::strLen(copy) );
 	REQUIRE(0 == bx::strCmp("1389", copy) );
 
-	constexpr bx::StringView sv = tmp[1];
+	constexpr bx::StringView sv(tmp[1]);
 
 	REQUIRE(5 == sv.getLength() );
 	REQUIRE(5 == bx::strLen(sv) );