2018-23-01 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / libgo / go / sync / cas.c
blob7571c64ddc4c4730a6a863495f62dc83174a3bef
1 /* cas.c -- implement sync.cas for Go.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #include <stdint.h>
9 #include "runtime.h"
11 _Bool cas (int32_t *, int32_t, int32_t) __asm__ (GOSYM_PREFIX "libgo_sync.sync.cas");
13 _Bool
14 cas (int32_t *ptr, int32_t old, int32_t new)
16 return __sync_bool_compare_and_swap (ptr, old, new);