1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
: "cc", "memory"
);
return i;
}
static OF_INLINE bool
OFAtomicIntCompAndSwap(volatile int *_Nonnull p, int o, int n)
{
int r;
__asm__ __volatile__ (
"0:\n\t"
"lwarx %0, 0, %3\n\t"
"cmpw %0, %1\n\t"
|
|
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
: "cc", "memory"
);
return i;
}
static OF_INLINE bool
OFAtomicIntCompareAndSwap(volatile int *_Nonnull p, int o, int n)
{
int r;
__asm__ __volatile__ (
"0:\n\t"
"lwarx %0, 0, %3\n\t"
"cmpw %0, %1\n\t"
|