java/src/org/openantivirus/util PatternOptimizer.java,1.3,1.4

Kurt Huwig <[email protected]> Thu, 20 May 2004 13:34:35 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/java/src/org/openantivirus/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11620/src/org/openantivirus/util

Modified Files:
	PatternOptimizer.java 
Log Message:
Speed improvements

Index: PatternOptimizer.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/util/PatternOptimizer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PatternOptimizer.java	20 May 2004 13:04:49 -0000	1.3
+++ PatternOptimizer.java	20 May 2004 13:34:32 -0000	1.4
@@ -95,13 +95,11 @@
                 for (int j = 0; j < wp.skipList.length; j++) {
                     final int skipCount = wp.skipList[j];
                     
-                    if (j % 2 == 0 && skipCount >= 2) {
+                    if ((j & 1) == 0 && skipCount >= 2) {
                         match = wp.pattern[pos] & 0xff;
                         
                         for (int i = 1; i < skipCount; i++) {
-                            match &= 0xff;
-                            match <<= 8;
-                            match |= wp.pattern[pos + i] & 0xff;
+                            match = ((match << 8) | wp.pattern[i]) & 0xffff;
                             
                             final int tripleCount = count[match];
                             if (tripleCount <= min) {



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click