Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-11-24 16:05 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (350 votes). Check out past polls.