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