in reply to Reading individual bits
If I'm reading this correctly, the bitstring your passing in is an "ascii-ized binary" string? If so, then the conversion of your strings from real binary to ascii-ized binary is the source of one performance hit. You should not need to do that.
Have you looked at vec? It only deals with powers-of-two numbers of bits, but it it may fit your needs. If not it is easily adapted to do so.
You can almost certainly get away with not padding your numbers with trailing zeros before conversion, pack and unpack are pretty clever about such things.
I'd have had a go at providing an alternative subroutine, but it's structure--the way it maintains values in the callers scope through references--plus the confusion over the terms 'binary' and 'bitstring' would mean making (possibly wrong) guesses about this subroutines use.
Perhaps you could post a short program that sets up a piece of test data, and then calls this subroutine to extract a couple of values from it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading individual bits
by iKnowNothing (Scribe) on Jul 29, 2004 at 23:26 UTC | |
by BrowserUk (Patriarch) on Jul 30, 2004 at 00:52 UTC | |
by BrowserUk (Patriarch) on Jul 30, 2004 at 01:17 UTC | |
by Anonymous Monk on Jul 30, 2004 at 13:41 UTC |