[CMake] Add HAVE check for __int128_t
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 May 2017 08:58:30 +0000 (08:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 May 2017 08:58:30 +0000 (08:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172317

Patch by Don Olmstead <don.olmstead@am.sony.com> on 2017-05-19
Reviewed by Yusuke Suzuki.

.:

* Source/cmake/OptionsCommon.cmake:

Source/WTF:

* wtf/MediaTime.cpp:
(WTF::MediaTime::setTimeScale):
* wtf/Platform.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/MediaTime.cpp
Source/WTF/wtf/Platform.h
Source/cmake/OptionsCommon.cmake

index 18d9a2d..d7360c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-19  Don Olmstead  <don.olmstead@am.sony.com>
+
+        [CMake] Add HAVE check for __int128_t
+        https://bugs.webkit.org/show_bug.cgi?id=172317
+
+        Reviewed by Yusuke Suzuki.
+
+        * Source/cmake/OptionsCommon.cmake:
+
 2017-05-16  Zan Dobersek  <zdobersek@igalia.com>
 
         [WPE] Set and expose ENABLE_DEVELOPER_MODE in build when DEVELOPER_MODE is enabled
index 957266b..7d25938 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-19  Don Olmstead  <don.olmstead@am.sony.com>
+
+        [CMake] Add HAVE check for __int128_t
+        https://bugs.webkit.org/show_bug.cgi?id=172317
+
+        Reviewed by Yusuke Suzuki.
+
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::setTimeScale):
+        * wtf/Platform.h:
+
 2017-05-18  Andreas Kling  <akling@apple.com>
 
         [WK2] Notify WebPageProxy client when an active process goes over the inactive memory limit
index b0a1242..ae0e0d9 100644 (file)
@@ -489,7 +489,7 @@ void MediaTime::setTimeScale(uint32_t timeScale, RoundingFlags flags)
 
     timeScale = std::min(MaximumTimeScale, timeScale);
 
-#if !PLATFORM(WIN) && (CPU(X86_64) || CPU(ARM64))
+#if HAVE(INT128_T)
     __int128_t newValue = static_cast<__int128_t>(m_timeValue) * timeScale;
     int64_t remainder = newValue % m_timeScale;
     newValue = newValue / m_timeScale;
index 677f812..893979c 100644 (file)
 #define HAVE_TM_GMTOFF 1
 #define HAVE_TM_ZONE 1
 #define HAVE_TIMEGM 1
+
+#if CPU(X86_64) || CPU(ARM64)
+#define HAVE_INT128_T 1
+#endif
 #endif /* OS(DARWIN) */
 
 #if OS(UNIX)
index 7179f47..d32ed7d 100644 (file)
@@ -228,6 +228,7 @@ include(CheckIncludeFile)
 include(CheckFunctionExists)
 include(CheckSymbolExists)
 include(CheckStructHasMember)
+include(CheckTypeSize)
 
 macro(_HAVE_CHECK_INCLUDE _variable _header)
     check_include_file(${_header} ${_variable}_value)
@@ -280,3 +281,10 @@ _HAVE_CHECK_SYMBOL(HAVE_SIGNAL_H SIGTRAP signal.h)
 _HAVE_CHECK_STRUCT(HAVE_STAT_BIRTHTIME "struct stat" st_birthtime sys/stat.h)
 _HAVE_CHECK_STRUCT(HAVE_TM_GMTOFF "struct tm" tm_gmtoff time.h)
 _HAVE_CHECK_STRUCT(HAVE_TM_ZONE "struct tm" tm_zone time.h)
+
+# Check for int types
+check_type_size("__int128_t" INT128_VALUE)
+
+if (HAVE_INT128_VALUE)
+  SET_AND_EXPOSE_TO_BUILD(HAVE_INT128_T INT128_VALUE)
+endif ()