erthink / t1ha

One of the fastest hash functions
https://www.ptsecurity.com
Other
345 stars 31 forks source link

Could you improve t1ha for compile with Visual C++ 9.0? #6

Closed Slach closed 7 years ago

Slach commented 7 years ago

i use python extension for some my projects https://github.com/flier/pyfasthash/issues/8 your great t1ha hash function included into https://github.com/rurban/smhasher/issues/30 package

and after i change target platoform to x64 t1ha.c can't compile under VC++ 9.0, but he required for Python2.7 compilation ;(

please, could you help me resolve following errors?

 t1ha.c
    It is recommended to use Visual Studio 2015 (MSC 19.0) or newer.
    src\smhasher\t1ha.c(368) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(368) : error C2146: syntax error : missing ';' before identifier 'w0'
    src\smhasher\t1ha.c(368) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(368) : warning C4244: '=' : conversion from 'uint64_t' to 'int', possible loss of data
    src\smhasher\t1ha.c(369) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(369) : error C2146: syntax error : missing ';' before identifier 'w1'
    src\smhasher\t1ha.c(369) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(369) : warning C4244: '=' : conversion from 'uint64_t' to 'int', possible loss of data
    src\smhasher\t1ha.c(370) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(370) : error C2146: syntax error : missing ';' before identifier 'w2'
    src\smhasher\t1ha.c(370) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(370) : warning C4244: '=' : conversion from 'uint64_t' to 'int', possible loss of data
    src\smhasher\t1ha.c(371) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(371) : error C2146: syntax error : missing ';' before identifier 'w3'
    src\smhasher\t1ha.c(371) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(371) : warning C4244: '=' : conversion from 'uint64_t' to 'int', possible loss of data
    src\smhasher\t1ha.c(373) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(373) : error C2146: syntax error : missing ';' before identifier 'd02'
    src\smhasher\t1ha.c(373) : error C2065: 'd02' : undeclared identifier
    src\smhasher\t1ha.c(373) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(373) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(373) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
    src\smhasher\t1ha.c(374) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(374) : error C2146: syntax error : missing ';' before identifier 'c13'
    src\smhasher\t1ha.c(374) : error C2065: 'c13' : undeclared identifier
    src\smhasher\t1ha.c(374) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(374) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(374) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
    src\smhasher\t1ha.c(375) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(376) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(377) : error C2065: 'd02' : undeclared identifier
    src\smhasher\t1ha.c(377) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(378) : error C2065: 'c13' : undeclared identifier
    src\smhasher\t1ha.c(378) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(387) : error C2143: syntax error : missing ';' before 'const'
    src\smhasher\t1ha.c(389) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(389) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(389) : warning C4022: 'memcpy' : pointer mismatch for actual parameter 2
    src\smhasher\t1ha.c(389) : warning C4047: '=' : 'int' differs in levels of indirection from 'const uint64_t *'
    src\smhasher\t1ha.c(393) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(393) : warning C4022: 'fetch64_le' : pointer mismatch for actual parameter 1
    src\smhasher\t1ha.c(402) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(402) : warning C4022: 'fetch64_le' : pointer mismatch for actual parameter 1
    src\smhasher\t1ha.c(411) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(411) : warning C4022: 'fetch64_le' : pointer mismatch for actual parameter 1
    src\smhasher\t1ha.c(420) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(420) : warning C4022: 'tail64_le' : pointer mismatch for actual parameter 1
    src\smhasher\t1ha.c(428) : error C2061: syntax error : identifier 'fetch64_be'
    src\smhasher\t1ha.c(428) : error C2059: syntax error : ';'
    src\smhasher\t1ha.c(428) : error C2059: syntax error : 'type'
    src\smhasher\t1ha.c(522) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(522) : error C2146: syntax error : missing ';' before identifier 'w0'
    src\smhasher\t1ha.c(522) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(522) : warning C4013: 'fetch64_be' undefined; assuming extern returning int
    src\smhasher\t1ha.c(523) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(523) : error C2146: syntax error : missing ';' before identifier 'w1'
    src\smhasher\t1ha.c(523) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(524) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(524) : error C2146: syntax error : missing ';' before identifier 'w2'
    src\smhasher\t1ha.c(524) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(525) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(525) : error C2146: syntax error : missing ';' before identifier 'w3'
    src\smhasher\t1ha.c(525) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(527) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(527) : error C2146: syntax error : missing ';' before identifier 'd02'
    src\smhasher\t1ha.c(527) : error C2065: 'd02' : undeclared identifier
    src\smhasher\t1ha.c(527) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(527) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(527) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
    src\smhasher\t1ha.c(528) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(528) : error C2146: syntax error : missing ';' before identifier 'c13'
    src\smhasher\t1ha.c(528) : error C2065: 'c13' : undeclared identifier
    src\smhasher\t1ha.c(528) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(528) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(528) : warning C4244: '=' : conversion from 'unsigned __int64' to 'int', possible loss of data
    src\smhasher\t1ha.c(529) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(530) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(531) : error C2065: 'd02' : undeclared identifier
    src\smhasher\t1ha.c(531) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(532) : error C2065: 'c13' : undeclared identifier
    src\smhasher\t1ha.c(532) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(541) : error C2143: syntax error : missing ';' before 'const'
    src\smhasher\t1ha.c(543) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(543) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(543) : warning C4022: 'memcpy' : pointer mismatch for actual parameter 2
    src\smhasher\t1ha.c(543) : warning C4047: '=' : 'int' differs in levels of indirection from 'const uint64_t *'
    src\smhasher\t1ha.c(547) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(556) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(565) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(574) : error C2065: 'v' : undeclared identifier
    src\smhasher\t1ha.c(574) : warning C4022: 'tail64_be' : pointer mismatch for actual parameter 1
    src\smhasher\t1ha.c(582) : error C2061: syntax error : identifier 'tail32_le'
    src\smhasher\t1ha.c(582) : error C2059: syntax error : ';'
    src\smhasher\t1ha.c(582) : error C2059: syntax error : 'type'
    src\smhasher\t1ha.c(649) : error C2275: 'uint64_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(15) : see declaration of 'uint64_t'
    src\smhasher\t1ha.c(649) : error C2146: syntax error : missing ';' before identifier 'l'
    src\smhasher\t1ha.c(649) : error C2065: 'l' : undeclared identifier
    src\smhasher\t1ha.c(650) : error C2065: 'l' : undeclared identifier
    src\smhasher\t1ha.c(650) : warning C4244: '*=' : conversion from 'const uint64_t' to 'int', possible loss of data
    src\smhasher\t1ha.c(651) : error C2065: 'l' : undeclared identifier
    src\smhasher\t1ha.c(651) : error C2065: 'l' : undeclared identifier
    src\smhasher\t1ha.c(651) : warning C4293: '>>' : shift count negative or too big, undefined behavior
    src\smhasher\t1ha.c(652) : error C2065: 'l' : undeclared identifier
    src\smhasher\t1ha.c(686) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(686) : error C2146: syntax error : missing ';' before identifier 'w0'
    src\smhasher\t1ha.c(686) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(687) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(687) : error C2146: syntax error : missing ';' before identifier 'w1'
    src\smhasher\t1ha.c(687) : error C2065: 'w1' : undeclared identifier
    src\smhasher\t1ha.c(688) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(688) : error C2146: syntax error : missing ';' before identifier 'w2'
    src\smhasher\t1ha.c(688) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(689) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(689) : error C2146: syntax error : missing ';' before identifier 'w3'
    src\smhasher\t1ha.c(689) : error C2065: 'w3' : undeclared identifier
    src\smhasher\t1ha.c(691) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(691) : error C2146: syntax error : missing ';' before identifier 'c02'
    src\smhasher\t1ha.c(691) : error C2065: 'c02' : undeclared identifier
    src\smhasher\t1ha.c(691) : error C2065: 'w0' : undeclared identifier
    src\smhasher\t1ha.c(691) : error C2065: 'w2' : undeclared identifier
    src\smhasher\t1ha.c(692) : error C2275: 'uint32_t' : illegal use of this type as an expression
            D:\Portable\Python27\include\stdint.h(14) : see declaration of 'uint32_t'
    src\smhasher\t1ha.c(692) : fatal error C1003: error count exceeds 100; stopping compilation
    error: command 'C:\\Users\\e.klimov\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
Slach commented 7 years ago

successfull build recipe https://github.com/flier/pyfasthash/issues/8