Title: [284364] trunk
- Revision
- 284364
- Author
- [email protected]
- Date
- 2021-10-18 03:47:58 -0700 (Mon, 18 Oct 2021)
Log Message
Remove AVOID_NATIVE_INT128_T
https://bugs.webkit.org/show_bug.cgi?id=231888
Reviewed by Mark Lam.
Source/WTF:
* wtf/Int128.h:
Tools:
We can test Int128 without AVOID_NATIVE_INT128_T.
* TestWebKitAPI/Tests/WTF/Int128.cpp:
(TestWebKitAPI::TestUnary):
(TestWebKitAPI::TestBinary):
(TestWebKitAPI::ToNative):
(TestWebKitAPI::FromNative):
(TestWebKitAPI::TestVsNative):
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (284363 => 284364)
--- trunk/Source/WTF/ChangeLog 2021-10-18 10:40:40 UTC (rev 284363)
+++ trunk/Source/WTF/ChangeLog 2021-10-18 10:47:58 UTC (rev 284364)
@@ -1,3 +1,12 @@
+2021-10-18 Yusuke Suzuki <[email protected]>
+
+ Remove AVOID_NATIVE_INT128_T
+ https://bugs.webkit.org/show_bug.cgi?id=231888
+
+ Reviewed by Mark Lam.
+
+ * wtf/Int128.h:
+
2021-10-18 Kiet Ho <[email protected]>
Implement parsing and animation support for offset-distance, offset-position, offset-anchor
Modified: trunk/Source/WTF/wtf/Int128.h (284363 => 284364)
--- trunk/Source/WTF/wtf/Int128.h 2021-10-18 10:40:40 UTC (rev 284363)
+++ trunk/Source/WTF/wtf/Int128.h 2021-10-18 10:47:58 UTC (rev 284364)
@@ -10,12 +10,6 @@
#pragma once
-// Define AVOID_NATIVE_INT128_T to force the use of Int128Impl below instead of
-// the C++ compiler's native 128-bit unsigned integer type, if it has one.
-#ifndef AVOID_NATIVE_INT128_T
-#define AVOID_NATIVE_INT128_T 0
-#endif
-
#include <cstdint>
#include <type_traits>
#include <wtf/LeadingZeroBitCount.h>
@@ -266,7 +260,7 @@
std::uint64_t low_ {0}, high_ {0};
};
-#if !AVOID_NATIVE_INT128_T && HAVE(INT128_T)
+#if HAVE(INT128_T)
using UInt128 = __uint128_t;
using Int128 = __int128_t;
#else
Modified: trunk/Tools/ChangeLog (284363 => 284364)
--- trunk/Tools/ChangeLog 2021-10-18 10:40:40 UTC (rev 284363)
+++ trunk/Tools/ChangeLog 2021-10-18 10:47:58 UTC (rev 284364)
@@ -1,3 +1,20 @@
+2021-10-18 Yusuke Suzuki <[email protected]>
+
+ Remove AVOID_NATIVE_INT128_T
+ https://bugs.webkit.org/show_bug.cgi?id=231888
+
+ Reviewed by Mark Lam.
+
+ We can test Int128 without AVOID_NATIVE_INT128_T.
+
+ * TestWebKitAPI/Tests/WTF/Int128.cpp:
+ (TestWebKitAPI::TestUnary):
+ (TestWebKitAPI::TestBinary):
+ (TestWebKitAPI::ToNative):
+ (TestWebKitAPI::FromNative):
+ (TestWebKitAPI::TestVsNative):
+ (TestWebKitAPI::TEST):
+
2021-10-17 David Kilzer <[email protected]>
Add tests for WTF::OSObjectPtr/adoptOSObject in Cocoa with and without ARC
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Int128.cpp (284363 => 284364)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Int128.cpp 2021-10-18 10:40:40 UTC (rev 284363)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Int128.cpp 2021-10-18 10:47:58 UTC (rev 284364)
@@ -5,8 +5,6 @@
// Based on:
// https://github.com/llvm/llvm-project/blob/d480f968/flang/unittests/Evaluate/uint128.cpp
-#define AVOID_NATIVE_INT128_T 1
-
#include "config.h"
#include <wtf/Int128.h>
@@ -14,32 +12,35 @@
namespace TestWebKitAPI {
+using NonNativeInt128 = WTF::Int128Impl<true>;
+using NonNativeUInt128 = WTF::Int128Impl<false>;
+
static void TestUnary(std::uint64_t x)
{
- UInt128 n {x};
+ NonNativeUInt128 n { x };
EXPECT_EQ(x, static_cast<std::uint64_t>(n));
EXPECT_EQ(~x, static_cast<std::uint64_t>(~n));
EXPECT_EQ(-x, static_cast<std::uint64_t>(-n));
EXPECT_EQ(!x, static_cast<std::uint64_t>(!n));
EXPECT_TRUE(n == n);
- EXPECT_TRUE(n + n == n * static_cast<UInt128>(2));
- EXPECT_TRUE(n - n == static_cast<UInt128>(0));
- EXPECT_TRUE(n + n == n << static_cast<UInt128>(1));
- EXPECT_TRUE(n + n == n << static_cast<UInt128>(1));
+ EXPECT_TRUE(n + n == n * static_cast<NonNativeUInt128>(2));
+ EXPECT_TRUE(n - n == static_cast<NonNativeUInt128>(0));
+ EXPECT_TRUE(n + n == n << static_cast<NonNativeUInt128>(1));
+ EXPECT_TRUE(n + n == n << static_cast<NonNativeUInt128>(1));
EXPECT_TRUE((n + n) - n == n);
- EXPECT_TRUE(((n + n) >> static_cast<UInt128>(1)) == n);
+ EXPECT_TRUE(((n + n) >> static_cast<NonNativeUInt128>(1)) == n);
if (x) {
- EXPECT_TRUE(static_cast<UInt128>(0) / n == static_cast<UInt128>(0));
- EXPECT_TRUE(static_cast<UInt128>(n - 1) / n == static_cast<UInt128>(0));
- EXPECT_TRUE(static_cast<UInt128>(n) / n == static_cast<UInt128>(1));
- EXPECT_TRUE(static_cast<UInt128>(n + n - 1) / n == static_cast<UInt128>(1));
- EXPECT_TRUE(static_cast<UInt128>(n + n) / n == static_cast<UInt128>(2));
+ EXPECT_TRUE(static_cast<NonNativeUInt128>(0) / n == static_cast<NonNativeUInt128>(0));
+ EXPECT_TRUE(static_cast<NonNativeUInt128>(n - 1) / n == static_cast<NonNativeUInt128>(0));
+ EXPECT_TRUE(static_cast<NonNativeUInt128>(n) / n == static_cast<NonNativeUInt128>(1));
+ EXPECT_TRUE(static_cast<NonNativeUInt128>(n + n - 1) / n == static_cast<NonNativeUInt128>(1));
+ EXPECT_TRUE(static_cast<NonNativeUInt128>(n + n) / n == static_cast<NonNativeUInt128>(2));
}
}
static void TestBinary(std::uint64_t x, std::uint64_t y)
{
- UInt128 m {x}, n {y};
+ NonNativeUInt128 m { x }, n { y };
EXPECT_EQ(x, static_cast<std::uint64_t>(m));
EXPECT_EQ(y, static_cast<std::uint64_t>(n));
EXPECT_EQ(x & y, static_cast<std::uint64_t>(m & n));
@@ -64,21 +65,20 @@
}
#if HAVE(INT128_T)
-static __uint128_t ToNative(UInt128 n)
+static __uint128_t ToNative(NonNativeUInt128 n)
{
return static_cast<__uint128_t>(static_cast<std::uint64_t>(n >> 64)) << 64 |
static_cast<std::uint64_t>(n);
}
-static UInt128 FromNative(__uint128_t n)
+static NonNativeUInt128 FromNative(__uint128_t n)
{
- return UInt128 {static_cast<std::uint64_t>(n >> 64)} << 64 |
- UInt128 {static_cast<std::uint64_t>(n)};
+ return NonNativeUInt128 { static_cast<std::uint64_t>(n >> 64)} << 64 | NonNativeUInt128 { static_cast<std::uint64_t>(n) };
}
static void TestVsNative(__uint128_t x, __uint128_t y)
{
- UInt128 m {FromNative(x)}, n {FromNative(y)};
+ NonNativeUInt128 m { FromNative(x) }, n { FromNative(y) };
EXPECT_TRUE(ToNative(m) == x);
EXPECT_TRUE(ToNative(n) == y);
EXPECT_TRUE(ToNative(~m) == ~x);
@@ -113,7 +113,7 @@
for (int j {0}; j < 128; ++j) {
for (int k {0}; k < 128; ++k) {
- __uint128_t m {1}, n {1};
+ __uint128_t m { 1 }, n { 1 };
m <<= j;
n <<= k;
TestVsNative(m, n);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes