Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Bit string manipulation made easy with Bit::Manip

by jmlynesjr (Hermit)
on Jan 30, 2017 at 18:17 UTC ( #1180625=note: print w/replies, xml ) Need Help??


in reply to Bit string manipulation made easy with Bit::Manip

Steve:

You have set, on, & off, should you also have clr?

James

There's never enough time to do it right, but always enough time to do it over...

  • Comment on Re: Bit string manipulation made easy with Bit::Manip

Replies are listed 'Best First'.
Re^2: Bit string manipulation made easy with Bit::Manip
by stevieb (Abbot) on Jan 30, 2017 at 19:50 UTC

    Do you mean clr on a single bit? ie. do you mean 'unset' (or zero) it?, or do you mean the entire byte? I can definitely add that for completeness, but as soonix stated, $data = 0; will do it too.

      My thought was that James wanted _clr is to _set as _off is to _on... But that's not really necessary, since all you need to do is _set($data, $lsb, $bits, 0).

        Bingo!

        While not necessary, it seems that clr would complete the API. As an old assembly coder, I think in terms of setting, clearing and flipping/toggling bits.

        As a minor nit pick... Setting a bit "on" or "off" doesn't tell you if the hardware is turning a device "on" or "off". Depends on how the designer set up the hardware. Active high? Active low? Could be either.

        James

        There's never enough time to do it right, but always enough time to do it over...

Re^2: Bit string manipulation made easy with Bit::Manip
by soonix (Monsignor) on Jan 30, 2017 at 19:08 UTC
    Hmm, … but you could just do $data = 0; or did I understand you wrong?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1180625]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2018-01-18 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (211 votes). Check out past polls.

    Notices?