in reply to
5x6-bit values into/out of a 32-bit word
Assuming the following bit layout:
0055 5555 4444 4433 3333 2222 2211 1111
# Get individual num:
$num = ($aggregate >> ($i*6)) & 0b111111;
# Set individual num:
$aggregate = ($aggregate & ~(0x3F << ($i*6))) | ($num << ($i*6));
Update: Added missing ~.
Update: Thelonius's newer post shows how to use this method to get/set all the nums at once.
0 - I'm a blankster
0 - My devices have no keyboard
0 - I use a chorded keyboard that transcends your concept of keys
26 - I need the other keys for Perl sigils!
31 - I write code in the original APL
31 - ß counts only as one letter!
∞ - I use an Optimus keyboard
ℵ1 - I reject your Latin-centric notion of letters
Results (35 votes),