diff --git a/include/X11/Xmu/EditresP.h b/include/X11/Xmu/EditresP.h
index 1591e0f..3530345 100644
--- a/include/X11/Xmu/EditresP.h
+++ b/include/X11/Xmu/EditresP.h
@@ -265,6 +265,7 @@ in this Software without prior written authorization from The Open Group.
 
 ************************************************************/
 
+#include <stdint.h>
 #include <X11/Intrinsic.h>
 #include <X11/Xfuncproto.h>
 #include <X11/Xmd.h>
@@ -291,12 +292,7 @@ in this Software without prior written authorization from The Open Group.
 #define EDITRES_COMM_ATOM    "EditresComm"
 #define EDITRES_CLIENT_VALUE "EditresClientVal"
 #define EDITRES_PROTOCOL_ATOM "EditresProtocol"
-
-#ifdef LONG64
-#define ID2WIDGET(X) ((Widget)(void *)((X)))
-#else
-#define ID2WIDGET(X) ((Widget)(void *)((X) & 0xffffffff))
-#endif
+#define ID2WIDGET(X) ((Widget)(void *)(uintptr_t)((X)))
 
 typedef enum {
   SendWidgetTree = 0,
diff --git a/src/EditresCom.c b/src/EditresCom.c
index 07b7bfd..b085acf 100644
--- a/src/EditresCom.c
+++ b/src/EditresCom.c
@@ -1631,7 +1631,7 @@ InsertWidget(ProtocolStream *stream, Widget w)
      * make sure that they are inserted in the list from parent -> child
      */
     for (i--, temp = w; temp != NULL; temp = XtParent(temp), i--)
-    widget_list[i] = (CARD64)temp;
+    widget_list[i] = (CARD64)(uintptr_t)temp;
 
     _XEditResPut16(stream, num_widgets);	/* insert number of widgets */
     for (i = 0; i < num_widgets; i++)		/* insert Widgets themselves */
--
