Test sizeof(drm_handle_t) instead of LONG64 when returning handles
[mesa.git] / src / glx / x11 / XF86dri.c
index b94fd97d3441f8ffbd515e7170be46cbb9b67e7a..3f989fa986e147c17bc9b2f7461ecdb7fffc9a13 100644 (file)
@@ -39,10 +39,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define NEED_REPLIES
 #include <X11/Xlibint.h>
-#include "xf86dristr.h"
 #include <X11/extensions/Xext.h>
-#include "extutil.h"
+#include <X11/extensions/extutil.h>
 #include "glheader.h"
+#include "xf86dristr.h"
 
 static XExtensionInfo _xf86dri_info_data;
 static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
@@ -200,9 +200,10 @@ PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString)
     }
 
     *hSAREA = rep.hSAREALow;
-#ifdef LONG64
-    *hSAREA |= ((drm_handle_t)rep.hSAREAHigh) << 32;
-#endif
+    if (sizeof(drm_handle_t) == 8) {
+       const int shift = 32; /* var to prevent warning on next line */
+       *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
+    }
 
     if (rep.length) {
         if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
@@ -562,9 +563,10 @@ PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
     }
 
     *hFrameBuffer = rep.hFrameBufferLow;
-#ifdef LONG64
-    *hFrameBuffer |= ((drm_handle_t)rep.hFrameBufferHigh) << 32;
-#endif
+    if (sizeof(drm_handle_t) == 8) {
+       const int shift = 32; /* var to prevent warning on next line */
+       *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
+    }
 
     *fbOrigin = rep.framebufferOrigin;
     *fbSize = rep.framebufferSize;