Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: 5x6-bit values into/out of a 32-bit word

by grinder (Bishop)
on Mar 18, 2007 at 17:37 UTC ( #605371=note: print w/ replies, xml ) Need Help??


in reply to Re^4: 5x6-bit values into/out of a 32-bit word
in thread 5x6-bit values into/out of a 32-bit word

In Perl, of course, the difference would not be worth mentioning, but in C, my unrolled-loop version is much faster than a version with a loop.

Yes, but this is Perl we are talking about, a language where a cosine is really no more expensive than an addition, not C. Perl is about flexibility, C is about speed.

if we are using a lot of them, probably millions

If you have millions of them, then Perl is the wrong language to use.

All I know is that seeing those multiples of 6 raises a red flag, at least as far as Perl is concerned. That code strikes me as fragile, in that it does not adapt to changing requirements readily (which is one of the reasons I code in Perl). Remember the cardinal virtue of Laziness.

Also, while I don't know why BrowserUK wants to do this, I maintain my reasoning is as valid as yours. There are dozens of ways of packing small bitmaps into a 32-bit quantity, and far more can be packed into a 64-bit quantity, as 64-bit CPUs become more prevalent.

• another intruder with the mooring in the heart of the Perl


Comment on Re^5: 5x6-bit values into/out of a 32-bit word

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-12-20 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls