-
-
Save gerdr/627e5508d69920e6e3aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $ldtype := nqp::newtype(NQPMu, 'CScalar'); | |
nqp::composetype($ldtype, 'CLDouble'); | |
my $coltype := nqp::newtype(NQPMu, 'CArray'); | |
nqp::composetype($coltype, [$ldtype, 4]); | |
my $mattype := nqp::newtype(NQPMu, 'CArray'); | |
nqp::composetype($mattype, [$coltype, 4]); | |
say(nqp::csizeof($mattype)); | |
my $ptr := nqp::bloballoc(nqp::csizeof($mattype)); | |
my $arr := nqp::ptrcast($ptr, $mattype, 0); | |
my $i := 0; | |
while $i < 4 { | |
my $j := 0; | |
my $col := $arr[$i]; | |
while $j < 4 { | |
nqp::bindpos_n($col, $j, ($i + 1) * 10 + ($j + 1) + 0.5); | |
$j := $j + 1; | |
} | |
$i := $i + 1; | |
} | |
$i := 0; | |
while $i < 4 { | |
my $j := 0; | |
my $col := $arr[$i]; | |
while $j < 4 { | |
print(nqp::atpos_n($col, $j) ~ ' '); | |
$j := $j + 1; | |
} | |
print("\n"); | |
$i := $i + 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment