* atomic.h (ATOMIC_OR): _InterlockedOr is unavailable in VC6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-07-09 07:56:04 +00:00
parent 03c618daf0
commit 2a8a9d1def
2 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,6 @@
Sat Jul 9 16:54:35 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Jul 9 16:56:01 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* atomic.h (ATOMIC_OR): _InterlockedOr is unavailable in VC6.
* numeric.c (ULLONG_MAX): fallback definition.

View File

@ -2,7 +2,7 @@
#define RUBY_ATOMIC_H
#ifdef _WIN32
#ifdef _MSC_VER
#if defined _MSC_VER && _MSC_VER > 1200
#pragma intrinsic(_InterlockedOr)
#endif
typedef LONG rb_atomic_t;
@ -12,6 +12,19 @@ typedef LONG rb_atomic_t;
# define ATOMIC_DEC(var) InterlockedDecrement(&(var))
#if defined __GNUC__
# define ATOMIC_OR(var, val) __asm__("lock\n\t" "orl\t%1, %0" : "=m"(var) : "Ir"(val))
#elif defined _MSC_VER && _MSC_VER <= 1200
# define ATOMIC_OR(var, val) rb_w32_atomic_or(&(var), (val))
static inline void
rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
{
#ifdef _M_IX86
__asm mov eax, var;
__asm mov ecx, val;
__asm lock or [eax], ecx;
#else
#error unsupported architecture
#endif
}
#else
# define ATOMIC_OR(var, val) _InterlockedOr(&(var), (val))
#endif