--- a/pthread_barrier_wait.c
+++ b/pthread_barrier_wait.c
@@ -87,8 +87,8 @@
       result = ptw32_semwait (&(b->semBarrierBreeched));
     }
 
-  if ((PTW32_INTERLOCKED_VALUE)PTW32_INTERLOCKED_INCREMENT((PTW32_INTERLOCKED_PTR)&b->nCurrentBarrierHeight)
-		  == (PTW32_INTERLOCKED_VALUE)b->nInitialBarrierHeight)
+  if ((PTW32_INTERLOCKED_LONG)PTW32_INTERLOCKED_INCREMENT_LONG((PTW32_INTERLOCKED_PTR)&b->nCurrentBarrierHeight)
+		  == (PTW32_INTERLOCKED_LONG)b->nInitialBarrierHeight)
     {
       /*
        * We are the last thread to cross this barrier