Re: I need the speed
- Posted by "Lucius L. Hilley III" <luciuslhilleyiii at JUNO.COM> Mar 18, 1997
- 968 views
On Mon, 17 Mar 1997 13:58:20 -0500 Robert Craig <robert_craig at COMPUSERVE.COM> writes: RC: ---------------------- Information from the mail header RC: If you want more speed I would recommend avoiding RC: int_to_bits() and bits_to_int() in favor of a solution RC: that uses the new and_bits(), or_bits() etc. routines in v1.5. Agreed !!! BUT I went over the code thoroughly and I just don't get it. RC: bitbuffer = and_bits(bitbuffer, i) RC: bitbuffer = or_bits(bitbuffer, i2 * SHIFT3) RC: bitbufferlen = bitbufferlen + 3 + i + 1 Okay, I see that you aren't converting bits into integers. And you appear to handling the bits directly. This will save space, AND most likely time. bitbuffer is called repeatedly. Some times it will be empty. Some times it will contain remaing bits from last call. I don't see how you this code is keeping those bits and then adding to the end of them, the additional bits of information. RC: while bitbufferlen > 7 do RC: -- puts(file2, bits_to_int(bitbuffer[1..8]) RC: puts(file2, bitbuffer) -- low-order 8 bits will be written to file RC: RC: -- bitbuffer = bitbuffer[9..length(bitbuffer)] RC: bitbuffer = floor(bitbuffer / SHIFT8) -- shift right 8 bits RC: bitbufferlen = bitbufferlen - 8 RC: end while I see that bitbufferlen is being used as a pointer to tell me how many bits are stored in bitbuffer. I understand that only the lower 8 bits are written to file as a byte, And I see how this code is then removing that byte written from the bitbuffer. Please clarify how the remaing bits in bitbuffer will not be lost and how the bits to be added are being stored into bitbuffer. I can see how those bits are being written and removed but I just seem to be missing how they are being put into bitbuffer. I can easily see how bitbufferlen is keeping track of how many bits are in bitbuffer. Thanks in advance. --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I support transferring of files less than 64K. -- I can Decode both UU and Base64 format.