Implement RtlAtomicBitTestAndSet() and RtlAtomicBitTestAndSet64() intrinsic routines
This commit is contained in:
parent
9ce841e957
commit
abdb9b25db
@ -33,6 +33,16 @@ LONG_PTR
|
|||||||
RtlAtomicAnd64(IN VOLATILE PLONG_PTR Address,
|
RtlAtomicAnd64(IN VOLATILE PLONG_PTR Address,
|
||||||
IN LONG_PTR Mask);
|
IN LONG_PTR Mask);
|
||||||
|
|
||||||
|
XTFASTCALL
|
||||||
|
UCHAR
|
||||||
|
RtlAtomicBitTestAndSet(IN VOLATILE PLONG Base,
|
||||||
|
IN LONG Offset);
|
||||||
|
|
||||||
|
XTFASTCALL
|
||||||
|
UCHAR
|
||||||
|
RtlAtomicBitTestAndSet64(IN VOLATILE PLONGLONG Base,
|
||||||
|
IN LONGLONG Offset);
|
||||||
|
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
CHAR
|
CHAR
|
||||||
RtlAtomicCompareExchange8(IN VOLATILE PCHAR Address,
|
RtlAtomicCompareExchange8(IN VOLATILE PCHAR Address,
|
||||||
|
@ -93,6 +93,48 @@ RtlAtomicAnd64(IN VOLATILE PLONG_PTR Address,
|
|||||||
return __sync_fetch_and_and(Address, Mask);
|
return __sync_fetch_and_and(Address, Mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an atomic test of the specified bit of the specified long value and sets it to 1.
|
||||||
|
*
|
||||||
|
* @param Base
|
||||||
|
* Specifies a pointer to the variable.
|
||||||
|
*
|
||||||
|
* @param Offset
|
||||||
|
* Specifies the bit position to be tested.
|
||||||
|
*
|
||||||
|
* @return Returns a value of the specified bit.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
UCHAR
|
||||||
|
RtlAtomicBitTestAndSet(IN VOLATILE PLONG Base,
|
||||||
|
IN LONG Offset)
|
||||||
|
{
|
||||||
|
return (__atomic_fetch_or(Base, 1l << Offset, __ATOMIC_SEQ_CST) >> Offset) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an atomic test of the specified bit of the specified 64-bit long value and sets it to 1.
|
||||||
|
*
|
||||||
|
* @param Base
|
||||||
|
* Specifies a pointer to the variable.
|
||||||
|
*
|
||||||
|
* @param Offset
|
||||||
|
* Specifies the bit position to be tested.
|
||||||
|
*
|
||||||
|
* @return Returns a value of the specified bit.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTFASTCALL
|
||||||
|
UCHAR
|
||||||
|
RtlAtomicBitTestAndSet64(IN VOLATILE PLONGLONG Base,
|
||||||
|
IN LONGLONG Offset)
|
||||||
|
{
|
||||||
|
return (__atomic_fetch_or(Base, 1ll << Offset, __ATOMIC_SEQ_CST) >> Offset) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs atomically compare exchange operation on the 8-bit value.
|
* Performs atomically compare exchange operation on the 8-bit value.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user