summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscv_new/rtl/inc/dynarr.inc10
1 files changed, 6 insertions, 4 deletions
diff --git a/riscv_new/rtl/inc/dynarr.inc b/riscv_new/rtl/inc/dynarr.inc
index 1ac9e5b023..cb64142ba1 100644
--- a/riscv_new/rtl/inc/dynarr.inc
+++ b/riscv_new/rtl/inc/dynarr.inc
@@ -820,7 +820,12 @@ function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Po
a := PPointerArray(a)^[indices[i]];
{ skip kind and name }
- typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
+{$ifdef VER3_0}
+ typeInfo:=aligntoptr(typeInfo+2+PByte(typeInfo)[1]);
+{$else VER3_0}
+ typeInfo:=aligntoqword(typeInfo+2+PByte(typeInfo)[1]);
+{$endif VER3_0}
+
{ store the last element size for the index calculation }
elsize:=pdynarraytypedata(typeInfo)^.elSize;
{ element type info}
@@ -834,9 +839,6 @@ function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Po
exit(nil);
end;
- { skip kind and name }
- typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
-
result:=@(PByte(a)[indices[h]*elsize]);
end;