title: assembly intrinsic for atomic bit test and set (BTS)
body: <p><code>struct node* address; //format &lt;addr,flagBit1,flagBit2&gt;</code></p>
  
  <p>I want to use BTS to <strong>atomically</strong> set the <code>flagBit1</code> bit. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>I want to blindly set this bit without caring about if it was previously set or not</strong></p>
  
  <p>I can use assembly code to get this done as suggested in <a href="https://stackoverflow.com/questions/1983303/using-bts-assembly-instruction-with-gcc-compiler">Using bts assembly instruction with gcc compiler</a></p>
  
  <p>But  is there an intrinsic I can use which is portable across different architectures?</p>
  
  <p>For instance, <a href="http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html" rel="nofollow noreferrer">gcc Atomic Builtins</a> has <code>__sync_fetch_and_or</code>. Does this have the same property as BTS?</p>