Alexandre Julliard : include: Avoid depending on wine/port.h.

Alexandre Julliard julliard at winehq.org
Tue Jul 2 15:32:02 CDT 2019


Module: wine
Branch: master
Commit: 629f2709f13641ea72cc5d980a96af885514842d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=629f2709f13641ea72cc5d980a96af885514842d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul  2 09:55:08 2019 +0200

include: Avoid depending on wine/port.h.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/wined3d.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index abef3f0..9a698bc 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -26,10 +26,6 @@
 #ifndef __WINE_WINED3D_H
 #define __WINE_WINED3D_H
 
-#ifndef __WINE_WINE_PORT_H
-# error You must include wine/port.h to use this header
-#endif
-
 #include "wine/list.h"
 
 #define WINED3D_OK                                              S_OK
@@ -2761,7 +2757,7 @@ HRESULT __cdecl wined3d_extract_shader_input_signature_from_dxbc(struct wined3d_
 /* Return the integer base-2 logarithm of x. Undefined for x == 0. */
 static inline unsigned int wined3d_log2i(unsigned int x)
 {
-#ifdef HAVE___BUILTIN_CLZ
+#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
     return __builtin_clz(x) ^ 0x1f;
 #else
     static const unsigned int l[] =
@@ -2791,7 +2787,13 @@ static inline unsigned int wined3d_log2i(unsigned int x)
 
 static inline int wined3d_bit_scan(unsigned int *x)
 {
-    int bit_offset = ffs(*x) - 1;
+    int bit_offset;
+#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
+    bit_offset = __builtin_ffs(*x) - 1;
+#else
+    for (bit_offset = 0; bit_offset < 32; bit_offset++)
+        if (*x & (1u << bit_offset)) break;
+#endif
     *x ^= 1u << bit_offset;
     return bit_offset;
 }




More information about the wine-cvs mailing list