64-bit Windows fixes. Patch from Skywing.
[silc.git] / lib / silcutil / silcatomic.h
index 3a49aecf07f039d78de8d1241cd13ed470bbe597..de22f8022c7f25e1cce45c7785bc0fb3c36b4482 100644 (file)
@@ -437,7 +437,7 @@ SILC_ATOMIC_SET_INT_F(bits)                                         \
 SILC_ATOMIC_SET_INT_F(bits)                                            \
 {                                                                      \
   /* Windows */                                                                \
-  InterlockedExchange((LONG)&atomic->value, (LONG)value);              \
+  InterlockedExchange((LONG *)&atomic->value, (LONG)value);            \
 }
 
 #elif defined(__GNUC__) && (defined(SILC_I486) || defined(SILC_X86_64))
@@ -753,7 +753,7 @@ SILC_ATOMIC_ADD_INT_F(bits)                                         \
 SILC_ATOMIC_ADD_INT_F(bits)                                            \
 {                                                                      \
   SilcUInt##bits ret;                                                  \
-  SilcInt32 val = value;
+  SilcInt32 val = value;                                               \
   /* GCC + IA64 (GCC builtin atomic operations) */                     \
   ret = __sync_fetch_and_add(&atomic->value, val);                     \
   return ret + value;                                                  \
@@ -895,7 +895,7 @@ SILC_ATOMIC_INC_F(bits)                                                     \
 SILC_ATOMIC_INC_F(bits)                                                        \
 {                                                                      \
   /* Windows */                                                                \
-  InterlockedIncrement((LONG)&atomic->value);                          \
+  InterlockedIncrement((LONG *)&atomic->value);                                \
 }
 
 #elif defined(__GNUC__) && (defined(SILC_I486) || defined(SILC_X86_64))
@@ -1001,7 +1001,7 @@ SILC_ATOMIC_DEC_F(bits)                                                   \
 SILC_ATOMIC_DEC_F(bits)                                                        \
 {                                                                      \
   /* Windows */                                                                \
-  InterlockedDecrement((LONG)&atomic->value);                          \
+  InterlockedDecrement((LONG *)&atomic->value);                                \
 }
 
 #elif defined(__GNUC__) && (defined(SILC_I486) || defined(SILC_X86_64))
@@ -1230,7 +1230,7 @@ SilcBool silc_atomic_cas_pointer(SilcAtomicPointer *atomic, void *old_val,
 
 #elif defined(__GNUC__) && defined(SILC_IA64)
   /* GCC + IA64 (GCC builtin atomic operations) */
-  return  __sync_bool_compare_and_swap((long)&atomic->value, (long)old_val,
+  return  __sync_bool_compare_and_swap((long *)&atomic->value, (long)old_val,
                                       (long)new_val);
 
 #elif defined(__GNUC__) && defined(SILC_POWERPC)