]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
* Fix indexes in fuzzy hashes calculations
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 16 Jul 2009 14:40:24 +0000 (18:40 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 16 Jul 2009 14:40:24 +0000 (18:40 +0400)
* Add optimization flags support
* Enable -O by default

CMakeLists.txt
src/fuzzy.c

index 5c2d2cbc12821edb8f569829acc35b500bfed14e..4c4dcbb728f534539b7b01750571bcca637e278f 100644 (file)
@@ -265,8 +265,14 @@ ELSE (MD5_INCLUDE)
        MESSAGE(STATUS "WARNING: Using internal MD5 support")
 ENDIF (MD5_INCLUDE)
 
+IF(ENABLE_OPTIMIZATION MATCHES "ON")
+       SET(CMAKE_C_OPT_FLAGS "-O3")
+ELSE(ENABLE_OPTIMIZATION MATCHES "ON")
+       SET(CMAKE_C_OPT_FLAGS "-O")
+ENDIF(ENABLE_OPTIMIZATION MATCHES "ON")
+
 SET(CMAKE_C_WARN_FLAGS "-Wall -W -Wpointer-arith -Wno-unused-parameter -Wno-unused-function -Wunused-variable -Wno-sign-compare -Wunused-value -Wno-declaration-after-statement -Wno-pointer-sign")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS} -std=c99")
+SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS} -std=c99")
 
 # Platform specific routines
 IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
index 49bb9da2763dabeb9d4ad91e0fc28058188f6cd5..9e49649aa754ce288743d9a09cbd168bc4c336c6 100644 (file)
@@ -63,7 +63,7 @@ fuzzy_roll_hash (char c)
        rs.h[2] <<= 5;
        rs.h[2] ^= c;
   
-       return rs.h[1] + rs.h[2] + rs.h[3];
+       return rs.h[0] + rs.h[1] + rs.h[2];
 }
 
 /* A simple non-rolling hash, based on the FNV hash */