Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Factoring out common code in two methods of a class

by jvector (Friar)
on Aug 06, 2009 at 10:07 UTC ( [id://786362]=note: print w/replies, xml ) Need Help??


in reply to Re: Factoring out common code in two methods of a class
in thread Factoring out common code in two methods of a class

The problem with vec is that it will only deal with powers-of-two numbers of bits. For example, there is no way to get at your 7-bit field directly using vec.
Aiee! I had found the existence of vec and had it in a tab on my browser but had not studied it at the time I wrote that update...

I had also done a CPAN search ( for "bits", as I recall) and there was one bit-manipulating utils module there (I don't recall the exact name) that had the same restriction (only operable on fields of 1,2,4,8... bits). Since these data structures tend to be dreamed up by hardware/comms engineers who are concerned with cramming the maximum amount of "useful" information into the smallest amount of bits, that restriction is not very helpful.

Getting a 7-bit field back as 7 individual 0|1s isn't ideal.
But it may be the least ugly/painful way. There's obviously MTOW to do it but not all are equally attractive.

The last signature was better than this one
  • Comment on Re^2: Factoring out common code in two methods of a class

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://786362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found