--- a/pthread_mutex_unlock.c
+++ b/pthread_mutex_unlock.c
@@ -66,7 +66,7 @@
 	    {
 	      LONG idx;
 
-	      idx = (LONG) PTW32_INTERLOCKED_EXCHANGE_LONG ((PTW32_INTERLOCKED_PTR)&mx->lock_idx,
+	      idx = (LONG) PTW32_INTERLOCKED_EXCHANGE_LONG ((PTW32_INTERLOCKED_LONGPTR)&mx->lock_idx,
 							    (PTW32_INTERLOCKED_LONG)0);
 	      if (idx != 0)
 	        {
@@ -91,7 +91,7 @@
 		    {
 		      mx->ownerThread.p = NULL;
 
-		      if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG ((PTW32_INTERLOCKED_PTR)&mx->lock_idx,
+		      if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG ((PTW32_INTERLOCKED_LONGPTR)&mx->lock_idx,
 							          (PTW32_INTERLOCKED_LONG)0) < 0L)
 		        {
 		          /* Someone may be waiting on that mutex */
@@ -120,14 +120,14 @@
            */
           if (pthread_equal (mx->ownerThread, self))
             {
-              PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG((PTW32_INTERLOCKED_PTR) &mx->robustNode->stateInconsistent,
+              PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG((PTW32_INTERLOCKED_LONGPTR) &mx->robustNode->stateInconsistent,
                                                       (PTW32_INTERLOCKED_LONG)PTW32_ROBUST_NOTRECOVERABLE,
                                                       (PTW32_INTERLOCKED_LONG)PTW32_ROBUST_INCONSISTENT);
               if (PTHREAD_MUTEX_NORMAL == kind)
                 {
                   ptw32_robust_mutex_remove(mutex, NULL);
 
-                  if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG((PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                  if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG((PTW32_INTERLOCKED_LONGPTR) &mx->lock_idx,
                                                              (PTW32_INTERLOCKED_LONG) 0) < 0)
                     {
                       /*
@@ -146,7 +146,7 @@
                     {
                       ptw32_robust_mutex_remove(mutex, NULL);
 
-                      if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG((PTW32_INTERLOCKED_PTR) &mx->lock_idx,
+                      if ((LONG) PTW32_INTERLOCKED_EXCHANGE_LONG((PTW32_INTERLOCKED_LONGPTR) &mx->lock_idx,
                                                                  (PTW32_INTERLOCKED_LONG) 0) < 0)
                         {
                           /*