Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by jmlynesjr (Deacon)
on Jan 30, 2017 at 18:17 UTC ( [id://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 (Canon) 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 (Canon) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1180625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found