***ATTENTION OPTIMIZERS*** - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: ***ATTENTION OPTIMIZERS*** (/thread-883.html) |
***ATTENTION OPTIMIZERS*** - Mango - 05-17-2003 So...I don't know much about using bitwise operators as substitutes for normal math. This code has several "divide by 2's" in it. Does anyone have a good way of speeding things up? On my PC, a ~ 2MB file takes about 2 sec...seeing as I need the number for further manipulations, I'd like to minimize this time. I don't believe that this code correctly calculates the CRC32...however, it does give a pseudo-unique 4-byte number for any file...a number that will change with any change to the file...which is what I am after. Any help speeding things up, or alternate code that will *correctly* calculate the CRC32 for a file would be appreciated. Code: 'I adapted this code from: http://pbsound.basicguru.com/files/pbsource/crc32bas.bas ***ATTENTION OPTIMIZERS*** - na_th_an - 05-17-2003 Multiplications and divisions by powers of two can be substituted by shifts left or right (respectively). In QB there is no shift division but many people in this forum state that BC.EXE translates such multiplications/divisions by their correspondent shift, so it is right to use \2, \4, \8 and so on. ***ATTENTION OPTIMIZERS*** - Plasma - 05-17-2003 Read the characters in the buffer directly with PEEK instead of ASC(MID$()) |