FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
atomic_suncc.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef AVUTIL_ATOMIC_SUNCC_H
21 #define AVUTIL_ATOMIC_SUNCC_H
22 
23 #include <atomic.h>
24 #include <mbarrier.h>
25 
26 #include "atomic.h"
27 
28 #define avpriv_atomic_int_get atomic_int_get_suncc
29 static inline int atomic_int_get_suncc(volatile int *ptr)
30 {
31  __machine_rw_barrier();
32  return *ptr;
33 }
34 
35 #define avpriv_atomic_int_set atomic_int_set_suncc
36 static inline void atomic_int_set_suncc(volatile int *ptr, int val)
37 {
38  *ptr = val;
39  __machine_rw_barrier();
40 }
41 
42 #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_suncc
43 static inline int atomic_int_add_and_fetch_suncc(volatile int *ptr, int inc)
44 {
45  return atomic_add_int_nv(ptr, inc);
46 }
47 
48 #define avpriv_atomic_ptr_cas atomic_ptr_cas_suncc
49 static inline void *atomic_ptr_cas_suncc(void * volatile *ptr,
50  void *oldval, void *newval)
51 {
52  return atomic_cas_ptr(ptr, oldval, newval);
53 }
54 
55 #endif /* AVUTIL_ATOMIC_SUNCC_H */