2012-02-29_icc_atomic_increment_ed2.patch
modules/core/include/opencv2/core/operations.hpp (working copy) | ||
---|---|---|
52 | 52 |
#ifdef __cplusplus |
53 | 53 | |
54 | 54 |
/////// exchange-add operation for atomic operations on reference counters /////// |
55 |
#ifdef __GNUC__ |
|
55 |
#ifdef __INTEL_COMPILER // atomic increment on the Intel(tm) compiler |
|
56 |
#define CV_XADD(addr,delta) _InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta) |
|
57 |
#elif defined __GNUC__ |
|
56 | 58 |
|
57 | 59 |
#if __GNUC__*10 + __GNUC_MINOR__ >= 42 |
58 | 60 | |
... | ... | |
80 | 82 |
#undef max |
81 | 83 |
#undef abs |
82 | 84 |
#define CV_XADD(addr,delta) InterlockedExchangeAdd((long volatile*)(addr), (delta)) |
85 | ||
83 | 86 |
#else |
84 | ||
85 | 87 |
static inline int CV_XADD(int* addr, int delta) |
86 |
{ int tmp = *addr; *addr += delta; return tmp; } |
|
87 |
|
|
88 |
{ int tmp = *addr; *addr += delta; return tmp; } |
|
88 | 89 |
#endif |
89 | 90 | |
90 | 91 |
#include <limits> |