diff --git a/CMakeLists.txt b/CMakeLists.txt index e8dd9f8..05f57fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX /D__AVX__=1") elseif (USE_SEE4) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /D__SSE4_1__=1 /D__SSE2__=1") - elseif (USE_SEE) + elseif (USE_SEE2) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /D__SSE2__=1") endif () else () diff --git a/libs/boost-align/LICENSE_1_0.txt b/libs/boost-align/LICENSE_1_0.txt new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/libs/boost-align/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/libs/boost-core/LICENSE_1_0.txt b/libs/boost-core/LICENSE_1_0.txt new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/libs/boost-core/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/libs/boost-sort/LICENSE_1_0.txt b/libs/boost-sort/LICENSE_1_0.txt new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/libs/boost-sort/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/libs/xxhash/LICENSE b/libs/xxhash/LICENSE new file mode 100644 index 0000000..fa20595 --- /dev/null +++ b/libs/xxhash/LICENSE @@ -0,0 +1,48 @@ +xxHash Library +Copyright (c) 2012-2020 Yann Collet +All rights reserved. + +BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------- + +xxhsum command line interface +Copyright (c) 2013-2020 Yann Collet +All rights reserved. + +GPL v2 License + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/src/Utils.h b/src/Utils.h index f185fce..5d19069 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -116,7 +116,7 @@ namespace veryfasttree { buf.resize(size); snprintf(&buf.front(), size, format.c_str(), args ...); buf.resize(size - 1); - return std::move(buf); + return buf; } inline std::string strformat(const std::string &format) { diff --git a/src/operations/AVX256Operations.tcc b/src/operations/AVX256Operations.tcc index 4a85c35..4c2d889 100644 --- a/src/operations/AVX256Operations.tcc +++ b/src/operations/AVX256Operations.tcc @@ -1,28 +1,33 @@ -#ifndef FASTTREE_AVX256OPERATIONS_TCC -#define FASTTREE_AVX256OPERATIONS_TCC - #include "AVX256Operations.h" #include +#if (defined _WIN32 || defined WIN32 || defined WIN64 || defined _WIN64) //Fix windows union operator[] +#define getf(array, i) ((float*)&array)[i] +#define getd(array, i) ((double*)&array)[i] +#else +#define getf(array, i) array[i] +#define getd(array, i) array[i] +#endif + template<> inline float veryfasttree::AVX256Operations::mm_sum(__m128 sum) { sum = _mm_hadd_ps(sum, sum); - return sum[0] + sum[1]; + return getf(sum, 0) + getf(sum, 1); } template<> inline double veryfasttree::AVX256Operations::mm_sum(__m256d sum) { sum = _mm256_hadd_pd(sum, sum); - return sum[0] + sum[2]; + return getd(sum, 0) + getd(sum, 2); } template<> inline float veryfasttree::AVX256Operations::mm_sum(__m256 sum1, __m128 sum2) { sum2 = _mm_add_ps(*(__m128 *) &sum1, sum2); - sum2 = _mm_add_ps(*(__m128 *) &sum1[4], sum2); + sum2 = _mm_add_ps(*(__m128 *) &getf(sum1, 4), sum2); sum2 = _mm_hadd_ps(sum2, sum2); - return sum2[0] + sum2[1]; + return getf(sum2,0) + getf(sum2,1); } template<> @@ -554,4 +559,5 @@ inline __m128 veryfasttree::AVX256Operations::fastexpImpl(__m128 x) { return _mm_mul_ps(x, _mm_castsi128_ps(u)); } -#endif +#undef getf +#undef getd diff --git a/src/operations/AVX512Operations.tcc b/src/operations/AVX512Operations.tcc index 651f7c8..fe2b4ad 100644 --- a/src/operations/AVX512Operations.tcc +++ b/src/operations/AVX512Operations.tcc @@ -1,20 +1,25 @@ -#ifndef FASTTREE_AVX512OPERATIONS_TCC -#define FASTTREE_AVX512OPERATIONS_TCC - #include "AVX512Operations.h" #include +#if (defined _WIN32 || defined WIN32 || defined WIN64 || defined _WIN64) //Fix windows union operator[] +#define getf(array, i) ((float*)&array)[i] +#define getd(array, i) ((double*)&array)[i] +#else +#define getf(array, i) array[i] +#define getd(array, i) array[i] +#endif + template<> inline float veryfasttree::AVX512Operations::mm_sum(__m128 sum) { sum = _mm_hadd_ps(sum, sum); - return sum[0] + sum[1]; + return getf(sum, 0) + getf(sum, 1); } template<> inline double veryfasttree::AVX512Operations::mm_sum(__m256d sum) { sum = _mm256_hadd_pd(sum, sum); - return sum[0] + sum[2]; + return getd(sum, 0) + getd(sum, 2); } template<> @@ -652,4 +657,5 @@ inline __m128 veryfasttree::AVX512Operations::fastexpImpl(__m128 x) { return _mm_mul_ps(x, _mm_castsi128_ps(u)); } -#endif +#undef getf +#undef getd diff --git a/src/operations/SSE128Operations.tcc b/src/operations/SSE128Operations.tcc index 84788f9..923075b 100644 --- a/src/operations/SSE128Operations.tcc +++ b/src/operations/SSE128Operations.tcc @@ -1,16 +1,22 @@ -#ifndef FASTTREE_SSE128OPERATIONS_TCC -#define FASTTREE_SSE128OPERATIONS_TCC - #include "SSE128Operations.h" #include +#if (defined _WIN32 || defined WIN32 || defined WIN64 || defined _WIN64) //Fix windows union operator[] +#define getf(array, i) ((float*)&array)[i] +#define getd(array, i) ((double*)&array)[i] +#else +#define getf(array, i) array[i] +#define getd(array, i) array[i] +#endif + + template<> template<> inline float veryfasttree::SSE128Operations::mm_sum(__m128 sum) { #ifdef __SSE3__ sum = _mm_hadd_ps(sum, sum); - return sum[0] + sum[1]; + return getf(sum, 0) + getf(sum, 1); #else /* stupider but faster */ alignas(ALIGNMENT) float f[4]; @@ -22,7 +28,7 @@ inline float veryfasttree::SSE128Operations::mm_sum(__m128 sum) { template<> template<> inline double veryfasttree::SSE128Operations::mm_sum(__m128d sum) { - return sum[0] + sum[1]; + return getd(sum, 0) + getd(sum, 1); } template<> @@ -438,6 +444,5 @@ inline __m128d veryfasttree::SSE128Operations::fastexpImpl(__m128d x) return _mm_mul_pd(x, _mm_castsi128_pd(u)); } - -#endif - +#undef getf +#undef getd