Host introspection: Difference between revisions

→‎{{header|Perl 6}}: Replace experimental pack with a native solution (taken from C example)
No edit summary
(→‎{{header|Perl 6}}: Replace experimental pack with a native solution (taken from C example))
Line 836:
</pre>
=={{header|Perl 6}}==
Endian detection translated from C. {{works with|Rakudo|2018.03}}
<lang perl6>use experimental :packNativeCall;
say $*VM.config<ptr_size>;
my $bytes = nativecast(CArray[uint8], CArray[uint16].new(1));
say pack('N', 123456789).unpack('V') == 123456789 ?? 'big-endian' !! 'little-endian';</lang>
say $bytes[0] ?? "little-endian" !! "big-endian;</lang>
{{out}}
<pre>8
Anonymous user