Skip to content

Latest commit

 

History

History
128 lines (114 loc) · 4.04 KB

interlockedbittestandset-intrinsic-functions.md

File metadata and controls

128 lines (114 loc) · 4.04 KB
title _interlockedbittestandset Intrinsic Functions | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-tools
ms.tgt_pltfrm
ms.topic article
f1_keywords
_interlockedbittestandset_cpp
_interlockedbittestandset_HLEAcquire
_interlockedbittestandset64
_interlockedbittestandset
_interlockedbittestandset_rel
_interlockedbittestandset64_HLEAcquire
_interlockedbittestandset_HLERelease
_interlockedbittestandset_acq
_interlockedbittestandset_nf
_interlockedbittestandset64_cpp
_interlockedbittestandset64_HLERelease
dev_langs
C++
helpviewer_keywords
_interlockedbittestandset intrinsic
_interlockedbittestandset64 intrinsic
lock_bts instruction
ms.assetid b1b7e334-53ea-48cf-ba60-5fa3ef51a1fc
caps.latest.revision 16
author corob-msft
ms.author corob
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

_interlockedbittestandset Intrinsic Functions

Microsoft Specific

Generate an instruction which examines bit b of the address a and returns its current value before setting it to 1.

Syntax

unsigned char _interlockedbittestandset(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset_acq(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset_HLEAcquire(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset_HLERelease(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset_nf(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset_rel(  
   long *a,  
   long b  
);  
unsigned char _interlockedbittestandset64(  
   __int64 *a,  
   __int64 b  
);  
unsigned char _interlockedbittestandset64_HLEAcquire(  
   __int64 *a,  
   __int64 b  
);  
unsigned char _interlockedbittestandset64_HLERelease(  
   __int64 *a,  
   __int64 b  
);  

Parameters

[in] a
A pointer to the memory to examine.

[in] b
The bit position to test.

Return Value

The value of the bit at position b before it is set.

Requirements

Intrinsic Architecture Header
_interlockedbittestandset x86, ARM, [!INCLUDEvcprx64] <intrin.h>
_interlockedbittestandset_acq, _interlockedbittestandset_nf, _interlockedbittestandset_rel ARM <intrin.h>
_interlockedbittestandset_HLEAcquire, _interlockedbittestandset_HLERelease x86, [!INCLUDEvcprx64] <immintrin.h>
_interlockedbittestandset64 [!INCLUDEvcprx64] <intrin.h>
_interlockedbittestandset64_HLEAcquire, _interlockedbittestandset64_HLERelease [!INCLUDEvcprx64] <immintrin.h>

Remarks

On x86 and [!INCLUDEvcprx64] processors, these intrinsics use the lock bts instruction to read and set the specified bit to 1. The operation is atomic.

On ARM processors, use the intrinsics with _acq and _rel suffixes for acquire and release semantics, such as at the beginning and end of a critical section. The ARM intrinsics with an _nf ("no fence") suffix do not act as a memory barrier.

On Intel processors that support Hardware Lock Elision (HLE) instructions, the intrinsics with _HLEAcquire and _HLERelease suffixes include a hint to the processor that can accelerate performance by eliminating a lock write step in hardware. If these intrinsics are called on processors that do not support HLE, the hint is ignored.

These routines are only available as intrinsics.

END Microsoft Specific

See Also

Compiler Intrinsics
Conflicts with the x86 Compiler