LCOV - code coverage report
Current view: directory - src/include/gcc - atomic_ops.h (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 6 6 100.0 %
Date: 2014-07-02 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2011 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can be
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : #ifndef NATIVE_CLIENT_SRC_INCLUDE_NACL_ATOMIC_OPS_H_
       7                 : #define NATIVE_CLIENT_SRC_INCLUDE_NACL_ATOMIC_OPS_H_ 1
       8                 : 
       9                 : #include "native_client/src/include/portability.h"
      10                 : #include <stdint.h>
      11                 : 
      12                 : typedef int32_t Atomic32;
      13                 : 
      14         5460938 : static INLINE Atomic32 CompareAndSwap(volatile Atomic32* ptr,
      15                 :                                       Atomic32 old_value,
      16                 :                                       Atomic32 new_value) {
      17         5460938 :   return __sync_val_compare_and_swap(ptr, old_value, new_value);
      18                 : }
      19                 : 
      20              25 : static INLINE Atomic32 AtomicExchange(volatile Atomic32* ptr,
      21                 :                                       Atomic32 new_value) {
      22              25 :   return __sync_lock_test_and_set(ptr, new_value);
      23                 : }
      24                 : 
      25           41404 : static INLINE Atomic32 AtomicIncrement(volatile Atomic32* ptr,
      26                 :                                        Atomic32 increment) {
      27           41404 :   return __sync_add_and_fetch(ptr, increment);
      28                 : }
      29                 : 
      30                 : #endif  /* NATIVE_CLIENT_SRC_INCLUDE_NACL_ATOMIC_OPS_H_ */

Generated by: LCOV version 1.7