Host introspection: Difference between revisions

→‎{{header|Perl}}: Switch from 'intsize' to 'uvsize', because 'byteorder' reports the byte order in a UV, and I want the size to match the byte order.
(J: clean up sleepy mistake)
(→‎{{header|Perl}}: Switch from 'intsize' to 'uvsize', because 'byteorder' reports the byte order in a UV, and I want the size to match the byte order.)
Line 471:
Most basic example:
<lang perl>use Config;
print "intUV size: $Config{intsizeuvsize}, byte order: $Config{byteorder}\n";</lang>
Example output:
<pre>
intUV size: 4, byte order: 1234
</pre>
 
Line 480:
<lang perl>use 5.010;
use Config;
my ($size, $order, $end) = @Config{qw(intsizeuvsize byteorder)};
given ($order) {
when (join '', sort split '') { $end = 'little' }
Line 486:
default { $end = 'mixed' }
}
say "intUV size: $size, byte order: $order ($end-endian)";</lang>
Example outputs:
<pre>
intUV size: 4, byte order: 1234 (little-endian)
</pre>
<pre>
intUV size: 4, byte order: 3412 (mixed-endian)
</pre>
<pre>
intUV size: 8, byte order: 87654321 (big-endian)
</pre>
 
Anonymous user