From 18d6fff47fb0145c3bb1be33eaadbe85bab8e40d Mon Sep 17 00:00:00 2001 From: zhengchao Date: Mon, 21 Sep 2020 12:19:42 +0800 Subject: [PATCH] =?UTF-8?q?FQDN=5Fengine.cpp=E7=9A=84=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=85=BC=E5=AE=B9Visual=20Studio=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/FQDN_engine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/entry/FQDN_engine.cpp b/src/entry/FQDN_engine.cpp index 5e32585..1d9232e 100644 --- a/src/entry/FQDN_engine.cpp +++ b/src/entry/FQDN_engine.cpp @@ -27,7 +27,13 @@ //#include //#define popcnt_u64 _mm_popcnt_u64 //Use gcc builtin function to replace SSE4.2 instruction for portability + +#ifdef _MSC_VER +#include +#define __builtin_popcount __popcnt +#else #define popcnt_u64 __builtin_popcountl +#endif #define FOR(i, n) for(int i=0, _n=(int)(n); i<_n; i++) @@ -263,7 +269,7 @@ int CHashTrieFQDN::search(const char * FQDN, size_t FQDN_len, struct FQDN_match { if(m_num==0 || FQDN_len==0 || FQDN==NULL || n_result==0) return -1; - int match_num=0; + size_t match_num=0; const unsigned char * pb=(unsigned char *)FQDN; unsigned long long HASH[16]; /*假设域名级数不超过16*/ unsigned int P[16];