apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r170467 - /apr/apr/trunk/atomic/win32/apr_atomic.c
Date Mon, 16 May 2005 21:48:30 GMT
Author: wrowe
Date: Mon May 16 14:48:29 2005
New Revision: 170467

URL: http://svn.apache.org/viewcvs?rev=170467&view=rev
Log:

  These operations are NOT necessarily function-based on 64 bit
  architectures.  Performed with inline code, these function cast
  wrappers broke our API.  These original flavors should be present
  for all 64 bit compiler headers.

Modified:
    apr/apr/trunk/atomic/win32/apr_atomic.c

Modified: apr/apr/trunk/atomic/win32/apr_atomic.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/atomic/win32/apr_atomic.c?rev=170467&r1=170466&r2=170467&view=diff
==============================================================================
--- apr/apr/trunk/atomic/win32/apr_atomic.c (original)
+++ apr/apr/trunk/atomic/win32/apr_atomic.c Mon May 16 14:48:29 2005
@@ -63,17 +63,29 @@
 APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
 {
     /* we return old value, win32 returns new value :( */
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+    return InterlockedIncrement(mem) - 1;
+#else
     return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1;
+#endif
 }
 
 APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
 {
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+    return InterlockedDecrement(mem);
+#else
     return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem);
+#endif
 }
 
 APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
 {
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+    InterlockedExchange(mem, val);
+#else
     ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
+#endif
 }
 
 APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
@@ -84,7 +96,11 @@
 APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
                                            apr_uint32_t cmp)
 {
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+    return InterlockedCompareExchange(mem, with, cmp);
+#else
     return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp);
+#endif
 }
 
 APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
@@ -99,5 +115,9 @@
 
 APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
 {
+#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
+    return InterlockedExchange(mem, val);
+#else
     return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val);
+#endif
 }



Mime
View raw message