OSDN Git Service

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