Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/defs.hfa

    r7768b8d r21184e3  
    5353    return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
    5454}
    55 
    56 #define __CFA_NO_BIT_TEST_AND_SET__
    57 
    58 static inline bool bts(volatile unsigned long long int * target, unsigned long long int bit ) {
    59         #if defined(__CFA_NO_BIT_TEST_AND_SET__)
    60         unsigned long long int mask = 1ul << bit;
    61         unsigned long long int ret = __atomic_fetch_or(target, mask, (int)__ATOMIC_RELAXED);
    62         return (ret & mask) != 0;
    63     #else
    64         int result = 0;
    65         asm volatile(
    66             "LOCK btsq %[bit], %[target]\n\t"
    67             :"=@ccc" (result)
    68             : [target] "m" (*target), [bit] "r" (bit)
    69         );
    70         return result != 0;
    71     #endif
    72 }
    73 
    74 static inline bool btr(volatile unsigned long long int * target, unsigned long long int bit ) {
    75         #if defined(__CFA_NO_BIT_TEST_AND_SET__)
    76         unsigned long long int mask = 1ul << bit;
    77         unsigned long long int ret = __atomic_fetch_and(target, ~mask, (int)__ATOMIC_RELAXED);
    78         return (ret & mask) != 0;
    79         #else
    80         int result = 0;
    81         asm volatile(
    82             "LOCK btrq %[bit], %[target]\n\t"
    83             :"=@ccc" (result)
    84             : [target] "m" (*target), [bit] "r" (bit)
    85         );
    86         return result != 0;
    87     #endif
    88 }
Note: See TracChangeset for help on using the changeset viewer.