[前][次][番号順一覧][スレッド一覧]

ruby-changes:31804

From: glass <ko1@a...>
Date: Thu, 28 Nov 2013 00:13:14 +0900 (JST)
Subject: [ruby-changes:31804] glass:r43883 (trunk): * ruby_atomic.h: remove duplicate definisions between ATOMIC_XXX

glass	2013-11-28 00:13:08 +0900 (Thu, 28 Nov 2013)

  New Revision: 43883

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43883

  Log:
    * ruby_atomic.h: remove duplicate definisions between ATOMIC_XXX
      and ATOMIC_SIZE_XXX.

  Modified files:
    trunk/ChangeLog
    trunk/ruby_atomic.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43882)
+++ ChangeLog	(revision 43883)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Nov 28 00:07:28 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* ruby_atomic.h: remove duplicate definisions between ATOMIC_XXX
+	  and ATOMIC_SIZE_XXX.
+
 Wed Nov 27 23:55:50 2013  Masaki Matsushita  <glass.saga@g...>
 
 	* ruby_atomic.h: define ATOMIC_SIZE_CAS() with
Index: ruby_atomic.h
===================================================================
--- ruby_atomic.h	(revision 43882)
+++ ruby_atomic.h	(revision 43883)
@@ -16,9 +16,6 @@ typedef unsigned int rb_atomic_t; https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L16
 
 # define ATOMIC_SIZE_ADD(var, val) __atomic_fetch_add(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
-# define ATOMIC_SIZE_INC(var) __atomic_fetch_add(&(var), 1, __ATOMIC_SEQ_CST)
-# define ATOMIC_SIZE_DEC(var) __atomic_fetch_sub(&(var), 1, __ATOMIC_SEQ_CST)
-# define ATOMIC_SIZE_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
 # define ATOMIC_SIZE_CAS(var, oldval, newval) \
 ({ size_t oldvaldup = (oldval); \
    __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
@@ -39,9 +36,6 @@ typedef unsigned int rb_atomic_t; /* Any https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L36
 
 # define ATOMIC_SIZE_ADD(var, val) __sync_fetch_and_add(&(var), (val))
 # define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
-# define ATOMIC_SIZE_INC(var) __sync_fetch_and_add(&(var), 1)
-# define ATOMIC_SIZE_DEC(var) __sync_fetch_and_sub(&(var), 1)
-# define ATOMIC_SIZE_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
 
 #elif defined _WIN32
 #if defined _MSC_VER && _MSC_VER > 1200
@@ -139,8 +133,6 @@ extern rb_atomic_t ruby_atomic_compare_a https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L133
 
 # define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
 # define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
-# define ATOMIC_SIZE_INC(var) ((var)++)
-# define ATOMIC_SIZE_DEC(var) ((var)--)
 # define ATOMIC_SIZE_EXCHANGE(var, val) atomic_size_exchange(&(var), (val))
 static inline size_t
 atomic_size_exchange(size_t *ptr, size_t val)
@@ -151,6 +143,15 @@ atomic_size_exchange(size_t *ptr, size_t https://github.com/ruby/ruby/blob/trunk/ruby_atomic.h#L143
 }
 #endif
 
+#ifndef ATOMIC_SIZE_INC
+# define ATOMIC_SIZE_INC(var) ATOMIC_INC(var)
+#endif
+#ifndef ATOMIC_SIZE_DEC
+# define ATOMIC_SIZE_DEC(var) ATOMIC_DEC(var)
+#endif
+#ifndef ATOMIC_SIZE_EXCHANGE
+# define ATOMIC_SIZE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
+#endif
 #ifndef ATOMIC_SIZE_CAS
 # define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
 #endif

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]