in reply to Making two 8-bit numbers from indices of set bits
use strict; use warnings; my @indicies = qw(8 1 9); my $code; $code |= 1 << $_ for @indicies; printf "0x%02X 0x%02X\n", $code >> 8, $code & 0xFF;
Prints:
0x03 0x02
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Making two 8-bit numbers from indices of set bits
by diotalevi (Canon) on Feb 20, 2007 at 07:25 UTC |