The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Bertram on May 11, 2007, 05:20:39 PM

Title: Boyer Moore implementation
Post by: Bertram on May 11, 2007, 05:20:39 PM
Hi
I hope I will not be shot down in smoke and flames for being presumtuous, particularly as I am completely new to this forum and pretty inexperienced in assembly language programming.

I needed a fast string search routine and found one in bmh.asm in the masm library. I installed it in my program (which I hope is permitted) and it is all I could have hoped for. However I found that if the search string comprises the very last characters in the buffer through which the file is being passed, it gets missed, as the routine seems to stop one character short of the full length of the buffer.

Changing line 99 from 'jl Main_Loop' to 'jle Main_Loop' extends the search by one byte to the end of the buffer and all is sweetness and light again.

I may well be in error about this but if so I hope you will blame rather my lack of wit than goodwill.

Does anyone know of a good case insensitive adaptation?
:red
Bertram
Title: Re: Boyer Moore implementation
Post by: Tedd on May 11, 2007, 06:12:20 PM
Convert the search string to uppercase, convert the string being search in to uppercase. Search as before.
Title: Re: Boyer Moore implementation
Post by: hutch-- on May 12, 2007, 12:41:11 AM
Bertram,

Thanks for the effort, it certainly is not wasted. The problem for me is to make the time to set up a test piece to see what is happening with the algo as I have not touched it for years. Havew you tested either of the other two BM algos, the one you are using is the Horspool variation but there is a simplified version and a complete version as well. Usually the complete version has the fastest averages.