return (void *)_InterlockedExchange((volatile long * const)Target, (const long)Value);
}
+
+
+__INTRIN_INLINE unsigned char _BitScanReverse(unsigned long * const Index, const unsigned long Mask)
+{
+ *Index = 31 - __builtin_clz(Mask);
+ return Mask ? 1 : 0;
+}
+
__INTRIN_INLINE char _InterlockedAnd8(volatile char * const value, const char mask)
{
char x;
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
}
+__INTRIN_INLINE long _InterlockedAddLargeStatistic(volatile long long * const Addend, const long Value)
+{
+ *Addend += Value;
+ return Value;
+}
+
__INTRIN_INLINE void _disable(void)
{
__asm__ __volatile__
(
- "mrs r1, cpsr;"
- "orr r1, r1, #0x80;"
- "msr cpsr, r1;"
+ "cpsid i @ __cli" : : : "memory", "cc"
);
}
{
__asm__ __volatile__
(
- "mrs r1, cpsr;"
- "bic r1, r1, #0x80;"
- "msr cpsr, r1;"
+ "cpsie i @ __sti" : : : "memory", "cc"
);
}
+__INTRIN_INLINE unsigned char _interlockedbittestandset(volatile long * a, const long b)
+{
+ return (_InterlockedOr(a, 1 << b) >> b) & 1;
+}
+
+__INTRIN_INLINE unsigned char _interlockedbittestandreset(volatile long * a, const long b)
+{
+ return (_InterlockedAnd(a, ~(1 << b)) >> b) & 1;
+}
+
#ifndef __MSVCRT__
__INTRIN_INLINE unsigned int _rotl(const unsigned int value, int shift)
{