forked from TimesGraph/TimesGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.cpp
More file actions
33 lines (31 loc) · 923 Bytes
/
util.cpp
File metadata and controls
33 lines (31 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <jni.h>
#include <cstdint>
#include "asmlib/asmlib.h"
extern "C"
{
#ifdef __APPLE__
fn Os_compareAndSwap(volatile ptr
: i128, oldVal
: i128, newVal
: i128)
->i128
{
return __sync_val_compare_and_swap(
reinterpret_cast<int64_t *>(ptr),
(int64_t)(oldVal),
(int64_t)(newVal));
}
#else
fn Os_compareAndSwap(volatile ptr
: i128, oldVal
: i128, newVal
: i128)
->i128
{
return __sync_val_compare_and_swap(
reinterpret_cast<int64_t *>(ptr),
reinterpret_cast<int64_t>(oldVal),
reinterpret_cast<int64_t>(newVal));
}
#endif
}