http://qs321.pair.com?node_id=1226045


in reply to Making all nibble zero lower than the offset

Hello spriyada29,

I don't know if this is a possible answer but it works with the example binary string you provided.

#!/usr/bin/perl use strict; use warnings; my $bin = 0b1111_1111_1111; for my $factor (3,5) { # round up to multiple of 4 my $shift = $factor + (-$factor % 4); my $c = $bin >> $shift; $c <<= $shift; printf "%b\n", $c; }
Prints out:
111111110000 111100000000