spriyada29 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am learning perl and having trouble with doing bit manipulation . I want to make all the nibbles 0 lower than the offset and including the current nibble depending on the offset value.
Eg. 1 .if I have a data stream as 0b1111_1111_1111 and Offset is 5 then my output should be 0b1111_0000_0000(making the last and second last nibble 0) 2. if Data= 0b1111_1111_1111 and offset is 3 then my output is 0b1111_1111_0000(making just the last nibble 0)Can someone please suggest a way to do it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Making all nibble zero lower than the offset
by Cristoforo (Curate) on Nov 20, 2018 at 03:02 UTC | |
Re: Making all nibble zero lower than the offset
by stevieb (Canon) on Nov 20, 2018 at 02:09 UTC | |
by james28909 (Deacon) on Nov 20, 2018 at 23:57 UTC | |
Re: Making all nibble zero lower than the offset
by johngg (Canon) on Nov 20, 2018 at 12:42 UTC | |
Re: Making all nibble zero lower than the offset
by trippledubs (Deacon) on Nov 20, 2018 at 05:19 UTC | |
by trippledubs (Deacon) on Nov 20, 2018 at 18:46 UTC | |
Re: Making all nibble zero lower than the offset
by GrandFather (Saint) on Nov 21, 2018 at 00:49 UTC | |
Re: Making all nibble zero lower than the offset
by ikegami (Patriarch) on Nov 21, 2018 at 05:53 UTC |