-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathU64.java
More file actions
50 lines (37 loc) · 1.07 KB
/
Copy pathU64.java
File metadata and controls
50 lines (37 loc) · 1.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package arrayfire;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
import static arrayfire.ArrayFire.U64;
public class U64 implements DataType<U64.Meta> {
public static final Meta META = new Meta();
@Override
public Meta meta() {
return META;
}
@Override
public int code() {
return DataTypeEnum.U64.code();
}
public static class Meta implements DataType.Meta<U64, Long, long[]> {
@Override
public ValueLayout.OfLong layout() {
return ValueLayout.JAVA_LONG;
}
@Override
public U64 sumType() {
return U64;
}
@Override
public Long get(MemorySegment segment, int index) {
return segment.getAtIndex(layout(), index);
}
@Override
public void set(MemorySegment segment, int index, Long value) {
segment.setAtIndex(layout(), index, value);
}
@Override
public long[] createHeapArray(int length) {
return new long[length];
}
}
}