Results#-- set up the vars to be like what Win32::TieRegistry returns (a stri +ng and a number); my ($dword, $type) = ( '0x00500000', 4); if ( $type == 4 ) { $dword = hex $dword; } printf "Dword:\tdec:%d\thex:%x\n", $dword, $dword; my $mask = 0x00400000; printf "mask:\tdec:%d\thex:%x\n", $mask, $mask; my $flags = 0x00100000; printf "mask:\tdec:%d\thex:%x\n", $flags, $flags; my $testdw = $dword & $mask; my $newdw = $dword | $flags; printf "TestDW:\tdec:%d\thex:%x\n", $testdw, $testdw; printf "NewDW:\tdec:%d\thex:%x\n", $newdw, $newdw;
I think you still need the first $dword = hex $dword; as the return from Win32::TieRegistry is a string. - jDword: dec:5242880 hex:500000 mask: dec:4194304 hex:400000 mask: dec:1048576 hex:100000 TestDW: dec:4194304 hex:400000 NewDW: dec:5242880 hex:500000
In reply to Re: how to pack bits, flags and masks
by jimbojones
in thread how to pack bits, flags and masks
by anadem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |