File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
langkit/templates/java_api Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 102
102
${ elem_ni_ref_type} toRead;
103
103
104
104
// Iterate over all array elements
105
+ final int elemSize = SizeOf.get(${ elem_ni_type} .class);
105
106
for(int i = 0 ; i < size ; i++) {
106
- nativeItem = nativeItems.add(
107
- i * SizeOf.get(${ elem_ni_type} .class)
108
- );
107
+ nativeItem = nativeItems.add(i * elemSize);
109
108
toRead = WordFactory.unsigned(nativeItem.rawValue());
110
109
content[i] = ${
111
110
api.ni_wrap(cls .element_type, " toRead" , [])
166
165
${ elem_ni_ref_type} toWrite;
167
166
168
167
// Place all elements in the native array
168
+ final int elemSize = SizeOf.get(${ elem_ni_type} .class);
169
169
for(int i = 0 ; i < this.content.length ; i++) {
170
- nativeItem = nativeItems.add(
171
- i * SizeOf.get(${ elem_ni_type} .class)
172
- );
170
+ nativeItem = nativeItems.add(i * elemSize);
173
171
toWrite = WordFactory.unsigned(
174
172
nativeItem.rawValue()
175
173
);
You can’t perform that action at this time.
0 commit comments