diff --git a/.appveyor.yml b/.appveyor.yml index 880b8e1..10581fd 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,6 +34,10 @@ build_script: test_script: - nimble test + - IF "%PLATFORM%" == "x86" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 + - IF "%PLATFORM%" == "x64" CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 + - IF "%PLATFORM%" == "x64" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 + - nimble testvcc deploy: off diff --git a/.gitignore b/.gitignore index 739a54a..ff45144 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ nimcache +*.exe diff --git a/stew.nimble b/stew.nimble index 8b14c48..b00fb2b 100644 --- a/stew.nimble +++ b/stew.nimble @@ -12,3 +12,7 @@ requires "nim >= 1.2.0" task test, "Run all tests": exec "nim c -r --threads:off tests/all_tests" exec "nim c -r --threads:on -d:nimTypeNames tests/all_tests" + +task testvcc, "Run all tests with vcc compiler": + exec "nim c -r --cc:vcc --threads:off tests/all_tests" + exec "nim c -r --cc:vcc --threads:on -d:nimTypeNames tests/all_tests" diff --git a/stew/bitops2.nim b/stew/bitops2.nim index 8818599..58dc896 100644 --- a/stew/bitops2.nim +++ b/stew/bitops2.nim @@ -253,12 +253,12 @@ elif defined(vcc) and useBuiltins: template checkedScan(fnc: untyped, x: typed, def: typed): int = var index{.noinit.}: culong - if fnc(index.addr, v) == 0: def + if fnc(index.addr, v).int == 0: def else: index.int template bitScan(fnc: untyped, x: typed): int = var index{.noinit.}: culong - if fnc(index.addr, v) == 0: 0 + if fnc(index.addr, v).int == 0: 0 else: index.int func countOnesBuiltin(v: uint8|uint16|uint32): int = builtin_popcnt32(v.uint32).int @@ -266,8 +266,8 @@ elif defined(vcc) and useBuiltins: when arch64: builtin_popcnt64(v).int else: - builtin_popcnt32((v and 0xFFFFFFFF'u64).uint32).int + - builtin_popcnt32((v shr 32'u64).uint32).int + builtin_popcnt32((v and 0xFFFFFFFF'u64).cint).int + + builtin_popcnt32((v shr 32'u64).cint).int func firstOneBuiltin(v: uint8|uint16|uint32): int = 1 + checkedScan(bitScanForward, v.culong, -1) diff --git a/tests/nim.cfg b/tests/nim.cfg new file mode 100644 index 0000000..619bfaf --- /dev/null +++ b/tests/nim.cfg @@ -0,0 +1,4 @@ +vcc.exe = "cl.exe" +vcc.cpp.exe = "cl.exe" +vcc.linkerexe = "cl.exe" +vcc.cpp.linkerexe = "cl.exe" \ No newline at end of file