Skip to content

Commit 055d1c5

Browse files
authored
Merge pull request #52 from pps83/master-msvc-fixes
Port maskedvbyte/streamvbyte/varintgb to Visual Studio + msvc fixes
2 parents 19c9e6e + b6c613d commit 055d1c5

26 files changed

+79
-1158
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.sln eol=crlf
2+
*.vcxproj eol=crlf
3+
*.vcxproj.filters eol=crlf

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.o
2+
*.lo
3+
.DS_Store
4+
/msvc/.vs
5+
/msvc/Debug
6+
/msvc/Release
7+
/msvc/x64/Debug
8+
/msvc/x64/Release
9+
*.suo
10+
*.VC.db
11+
*.VC.opendb
12+
*.vcxproj.user

headers/VarIntG8IU.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
* This code is released under the
33
* Apache License Version 2.0 http://www.apache.org/licenses/.
44
*/
5-
#ifndef __SSSE3__
5+
#if !defined(__SSSE3__) && !(defined(_MSC_VER) && defined(__AVX__))
6+
#ifndef _MSC_VER
67
#pragma message \
78
"Disabling varintg8iu due to lack of SSSE3 support, try adding -mssse3 or the equivalent on your compiler"
89
#else
10+
#pragma message("Disabling varintg8iu due to lack of SSSE3 support, try adding -mssse3 or the equivalent on your compiler")
11+
#endif
12+
#else
913
#ifndef VARINTG8IU_H__
1014
#define VARINTG8IU_H__
1115
#include <emmintrin.h>
@@ -31,8 +35,6 @@ namespace FastPForLib {
3135
* This code was originally written by M. Caron and then
3236
* optimized by D. Lemire.
3337
*
34-
*
35-
*
3638
*/
3739
class VarIntG8IU : public IntegerCODEC {
3840

@@ -210,4 +212,4 @@ class VarIntG8IU : public IntegerCODEC {
210212
} // namespace FastPFor
211213

212214
#endif // VARINTG8IU_H__
213-
#endif //__SSE3__
215+
#endif // __SSSE3__

headers/codecfactory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,9 @@ static inline CodecMap initializefactory() {
125125
new CompositeCodec<SIMDOPTPFor<4, Simple16<false>>, VariableByte>());
126126
map["varint"] = std::shared_ptr<IntegerCODEC>(new VariableByte());
127127
map["vbyte"] = std::shared_ptr<IntegerCODEC>(new VByte());
128-
#if !(defined(_MSC_VER)) // todo: port to Visual Studio
129128
map["maskedvbyte"] = std::shared_ptr<IntegerCODEC>(new MaskedVByte());
130-
#endif
131-
#if !(defined(_MSC_VER)) // todo: streamvbyte needs to be ported to Visual Studio
132129
map["streamvbyte"] = std::shared_ptr<IntegerCODEC>(new StreamVByte());
133-
#endif
134-
#if !defined(_MSC_VER) || (_MSC_VER != 1900)
135130
map["varintgb"] = std::shared_ptr<IntegerCODEC>(new VarIntGB<>());
136-
#endif
137131
map["simple16"] = std::shared_ptr<IntegerCODEC>(new Simple16<true>());
138132
map["simple9"] = std::shared_ptr<IntegerCODEC>(new Simple9<true>());
139133
map["simple9_rle"] = std::shared_ptr<IntegerCODEC>(new Simple9_RLE<true>());

headers/horizontalbitpacking.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
#ifndef HORIZONTALBITPACKING_H_
2222
#define HORIZONTALBITPACKING_H_
2323

24-
#ifndef __SSE4_1__
24+
#if !defined(__SSE4_1__) && !(defined(_MSC_VER) && defined(__AVX__))
2525

2626
#ifndef _MSC_VER
27-
#pragma message "No SSSE4.1 support? try adding -msse4.1"
27+
#pragma message "No SSSE4.1 support? try adding -msse4.1 or the equivalent on your compiler"
28+
#else
29+
#pragma message("No SSSE4.1 support? try adding -msse4.1 or the equivalent on your compiler")
2830
#endif
2931
#endif
3032
#include "common.h"

headers/simdvariablebyte.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#ifndef SIMDVARIABLEBYTE_H_
1111
#define SIMDVARIABLEBYTE_H_
1212

13-
#if ! defined(_MSC_VER) // code relies on compound literals which Visual Studio fails to support. TODO: code a workaround
14-
15-
1613
#include "common.h"
1714
#include "codecs.h"
1815

@@ -97,5 +94,4 @@ class MaskedVByte : public FastPForLib::IntegerCODEC {
9794

9895
std::string name() const { return "MaskedVByte"; }
9996
};
100-
#endif
10197
#endif /* SIMDVARIABLEBYTE_H_ */

headers/streamvariablebyte.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
* (c) Daniel Lemire, http://lemire.me/en/
66
*/
77

8-
9-
108
#ifndef _STREAMVARIABLEBYTE_
119
#define _STREAMVARIABLEBYTE_
12-
#if !(defined(_MSC_VER)) // todo : need to be ported to Visual Studio
10+
1311
#include "common.h"
1412
#include "codecs.h"
1513

@@ -77,4 +75,3 @@ class StreamVByte : public IntegerCODEC {
7775
};
7876
}
7977
#endif
80-
#endif

msvc/FastPFor.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codecs", "codecs.vcxproj",
77
EndProject
88
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FastPFor", "FastPFor.vcxproj", "{42D8ABA4-FC4E-426C-A833-D64D06081F92}"
99
EndProject
10-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt", "getopt.vcxproj", "{D0D480B3-816E-4A04-8AE4-75210F8701E0}"
11-
EndProject
1210
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inmemorybenchmark", "inmemorybenchmark.vcxproj", "{635B18E0-2AD7-45A7-914E-831A6B711F89}"
1311
EndProject
1412
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit", "unit.vcxproj", "{8B2ED3AF-F2E8-480B-BE7D-7B6E44DC4BFE}"
@@ -37,10 +35,6 @@ Global
3735
{42D8ABA4-FC4E-426C-A833-D64D06081F92}.Debug|x64.Build.0 = Debug|x64
3836
{42D8ABA4-FC4E-426C-A833-D64D06081F92}.Release|x64.ActiveCfg = Release|x64
3937
{42D8ABA4-FC4E-426C-A833-D64D06081F92}.Release|x64.Build.0 = Release|x64
40-
{D0D480B3-816E-4A04-8AE4-75210F8701E0}.Debug|x64.ActiveCfg = Debug|x64
41-
{D0D480B3-816E-4A04-8AE4-75210F8701E0}.Debug|x64.Build.0 = Debug|x64
42-
{D0D480B3-816E-4A04-8AE4-75210F8701E0}.Release|x64.ActiveCfg = Release|x64
43-
{D0D480B3-816E-4A04-8AE4-75210F8701E0}.Release|x64.Build.0 = Release|x64
4438
{635B18E0-2AD7-45A7-914E-831A6B711F89}.Debug|x64.ActiveCfg = Debug|x64
4539
{635B18E0-2AD7-45A7-914E-831A6B711F89}.Debug|x64.Build.0 = Debug|x64
4640
{635B18E0-2AD7-45A7-914E-831A6B711F89}.Release|x64.ActiveCfg = Release|x64

msvc/FastPFor.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<Optimization>Disabled</Optimization>
4949
<SDLCheck>true</SDLCheck>
5050
<AdditionalIncludeDirectories>../headers</AdditionalIncludeDirectories>
51+
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
5152
</ClCompile>
5253
<Link>
5354
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -61,6 +62,7 @@
6162
<IntrinsicFunctions>true</IntrinsicFunctions>
6263
<SDLCheck>true</SDLCheck>
6364
<AdditionalIncludeDirectories>../headers</AdditionalIncludeDirectories>
65+
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
6466
</ClCompile>
6567
<Link>
6668
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -75,6 +77,8 @@
7577
<ClCompile Include="..\src\horizontalbitpacking.cpp" />
7678
<ClCompile Include="..\src\simdbitpacking.cpp" />
7779
<ClCompile Include="..\src\simdunalignedbitpacking.cpp" />
80+
<ClCompile Include="..\src\streamvbyte.c" />
81+
<ClCompile Include="..\src\varintdecode.c" />
7882
</ItemGroup>
7983
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
8084
<ImportGroup Label="ExtensionTargets">

msvc/benchbitpacking.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<SDLCheck>true</SDLCheck>
4949
<AdditionalIncludeDirectories>../headers</AdditionalIncludeDirectories>
5050
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
51+
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
5152
</ClCompile>
5253
<Link>
5354
<SubSystem>Console</SubSystem>
@@ -63,6 +64,7 @@
6364
<SDLCheck>true</SDLCheck>
6465
<AdditionalIncludeDirectories>../headers</AdditionalIncludeDirectories>
6566
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
67+
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
6668
</ClCompile>
6769
<Link>
6870
<EnableCOMDATFolding>true</EnableCOMDATFolding>

0 commit comments

Comments
 (0)