Closed onehundredfeet closed 3 months ago
Hi ! Could you please check with git latest version of Haxe ? It gives me the following
void Main_doCObjectObjRead(hl_carray* r0) {
Obj r7;
int r1, r3, r4, r5, r6;
r1 = 0;
r3 = 0;
label$36888b6_2_2:
r5 = 100;
if( r3 >= r5 ) goto label$36888b6_2_12;
r4 = r3;
++r3;
r7 = ((Obj)r0) + r4;
r6 = r7->value;
r5 = r1 + r6;
r1 = r5;
goto label$36888b6_2_2;
label$36888b6_2_12:
return;
}
CArray implementation has changed recently (you'll need both Haxe and Hashlink to the git version), before it carry the length value, and now it's more like a true C Array (designed for passing value to DX12 afaik)
nice.
I've been looking at the HL/C code generation for iterating over arrays. I've found native arrays to be the best. I was hoping CArrays would be better, but it seems there's an extra cast even though the type is known.
Results in the following two outputs.
The native array can cast directly to the pointer type, while the CArray has to go through the hl_dyn_castp. it would be awesome if it could avoid the hl_carray_get and the hl_dyn_castp and index the CArray directly as the type is known at compile time.