java/src/org/openantivirus/engine/censor/matcharray MatchArray.java,1.3,1.4 MatchArrayCensor.java,1.5,1.6

Kurt Huwig <[email protected]> Sat, 22 May 2004 14:48:13 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3490/src/org/openantivirus/engine/censor/matcharray

Modified Files:
	MatchArray.java MatchArrayCensor.java 
Log Message:
Speed improvements

Index: MatchArray.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray/MatchArray.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- MatchArray.java	22 May 2004 12:22:27 -0000	1.3
+++ MatchArray.java	22 May 2004 14:48:10 -0000	1.4
@@ -48,8 +48,7 @@
             throw new IllegalArgumentException("String too short");
         }
         
-        final int match = ((abPattern[0] << 8)
-                          | (abPattern[1] & 0xff)) & 0xffff;
+        final int match = ((abPattern[0] << 8) ^ abPattern[1]) & 0xffff;
         
         Collection colMatch = colMatches[match];
         if (colMatch == null) {

Index: MatchArrayCensor.java
===================================================================
RCS file: /cvsroot/openantivirus/java/src/org/openantivirus/engine/censor/matcharray/MatchArrayCensor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- MatchArrayCensor.java	22 May 2004 12:22:27 -0000	1.5
+++ MatchArrayCensor.java	22 May 2004 14:48:10 -0000	1.6
@@ -143,7 +143,7 @@
         final int scanLength = iOffset + iLength;
         final int postfix = scanLength + iSuffix;
         for (int i = iOffset; i < scanLength; i++) {
-            match = ((match << 8) | (ab[i] & 0xff)) & 0xffff;
+            match = ((match << 8) ^ ab[i]) & 0xffff;
            
             final PositionFoundListener[] matchListener = matchArray[match];
             if (matchListener != null) {



-------------------------------------------------------
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