-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathU32.java
50 lines (37 loc) · 1.07 KB
/
U32.java
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.U32;
public class U32 implements DataType<U32.Meta> {
public static final Meta META = new Meta();
@Override
public Meta meta() {
return META;
}
@Override
public int code() {
return DataTypeEnum.U32.code();
}
public static class Meta implements DataType.Meta<U32, Integer, int[]> {
@Override
public ValueLayout.OfInt layout() {
return ValueLayout.JAVA_INT;
}
@Override
public U32 sumType() {
return U32;
}
@Override
public Integer get(MemorySegment segment, int index) {
return segment.getAtIndex(layout(), index);
}
@Override
public void set(MemorySegment segment, int index, Integer value) {
segment.setAtIndex(layout(), index, value);
}
@Override
public int[] createHeapArray(int length) {
return new int[length];
}
}
}