Skip to content

Commit

Permalink
Merge pull request #79 from fastfloat/dlemire/vs_studio_persmissive_m…
Browse files Browse the repository at this point in the history
…inus

adding to recent Visual Studio builds a permissive- flag
  • Loading branch information
lemire authored Jun 1, 2021
2 parents 2f0c95f + 9519835 commit e3af106
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vs15-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
mkdir build
cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build --config Release --parallel
run: cmake --build build --verbose --config Release --parallel
- name: 'Run CTest'
run: |
cd build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/vs16-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
mkdir build &&
cd build &&
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
cmake --build . &&
cmake --build . --verbose &&
ctest --output-on-failure &&
cmake --install . &&
cd ../tests/installation_tests/find &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose
cd ../../issue72_installation &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ if(FASTFLOAT_SANITIZE)
target_link_libraries(fast_float INTERFACE -fuse-ld=gold)
endif()
endif()
if(MSVC_VERSION GREATER 1910)
target_compile_options(fast_float INTERFACE /permissive-)
endif()


include(CMakePackageConfigHelpers)

Expand Down
72 changes: 36 additions & 36 deletions include/fast_float/float_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,115 +210,115 @@ constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5,
1e6, 1e7, 1e8, 1e9, 1e10};

template <typename T> struct binary_format {
static constexpr int mantissa_explicit_bits();
static constexpr int minimum_exponent();
static constexpr int infinite_power();
static constexpr int sign_index();
static constexpr int min_exponent_fast_path();
static constexpr int max_exponent_fast_path();
static constexpr int max_exponent_round_to_even();
static constexpr int min_exponent_round_to_even();
static constexpr uint64_t max_mantissa_fast_path();
static constexpr int largest_power_of_ten();
static constexpr int smallest_power_of_ten();
static constexpr T exact_power_of_ten(int64_t power);
static inline constexpr int mantissa_explicit_bits();
static inline constexpr int minimum_exponent();
static inline constexpr int infinite_power();
static inline constexpr int sign_index();
static inline constexpr int min_exponent_fast_path();
static inline constexpr int max_exponent_fast_path();
static inline constexpr int max_exponent_round_to_even();
static inline constexpr int min_exponent_round_to_even();
static inline constexpr uint64_t max_mantissa_fast_path();
static inline constexpr int largest_power_of_ten();
static inline constexpr int smallest_power_of_ten();
static inline constexpr T exact_power_of_ten(int64_t power);
};

template <> constexpr int binary_format<double>::mantissa_explicit_bits() {
template <> inline constexpr int binary_format<double>::mantissa_explicit_bits() {
return 52;
}
template <> constexpr int binary_format<float>::mantissa_explicit_bits() {
template <> inline constexpr int binary_format<float>::mantissa_explicit_bits() {
return 23;
}

template <> constexpr int binary_format<double>::max_exponent_round_to_even() {
template <> inline constexpr int binary_format<double>::max_exponent_round_to_even() {
return 23;
}

template <> constexpr int binary_format<float>::max_exponent_round_to_even() {
template <> inline constexpr int binary_format<float>::max_exponent_round_to_even() {
return 10;
}

template <> constexpr int binary_format<double>::min_exponent_round_to_even() {
template <> inline constexpr int binary_format<double>::min_exponent_round_to_even() {
return -4;
}

template <> constexpr int binary_format<float>::min_exponent_round_to_even() {
template <> inline constexpr int binary_format<float>::min_exponent_round_to_even() {
return -17;
}

template <> constexpr int binary_format<double>::minimum_exponent() {
template <> inline constexpr int binary_format<double>::minimum_exponent() {
return -1023;
}
template <> constexpr int binary_format<float>::minimum_exponent() {
template <> inline constexpr int binary_format<float>::minimum_exponent() {
return -127;
}

template <> constexpr int binary_format<double>::infinite_power() {
template <> inline constexpr int binary_format<double>::infinite_power() {
return 0x7FF;
}
template <> constexpr int binary_format<float>::infinite_power() {
template <> inline constexpr int binary_format<float>::infinite_power() {
return 0xFF;
}

template <> constexpr int binary_format<double>::sign_index() { return 63; }
template <> constexpr int binary_format<float>::sign_index() { return 31; }
template <> inline constexpr int binary_format<double>::sign_index() { return 63; }
template <> inline constexpr int binary_format<float>::sign_index() { return 31; }

template <> constexpr int binary_format<double>::min_exponent_fast_path() {
template <> inline constexpr int binary_format<double>::min_exponent_fast_path() {
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
return 0;
#else
return -22;
#endif
}
template <> constexpr int binary_format<float>::min_exponent_fast_path() {
template <> inline constexpr int binary_format<float>::min_exponent_fast_path() {
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
return 0;
#else
return -10;
#endif
}

template <> constexpr int binary_format<double>::max_exponent_fast_path() {
template <> inline constexpr int binary_format<double>::max_exponent_fast_path() {
return 22;
}
template <> constexpr int binary_format<float>::max_exponent_fast_path() {
template <> inline constexpr int binary_format<float>::max_exponent_fast_path() {
return 10;
}

template <> constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
template <> inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
return uint64_t(2) << mantissa_explicit_bits();
}
template <> constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
template <> inline constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
return uint64_t(2) << mantissa_explicit_bits();
}

template <>
constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
inline constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
return powers_of_ten_double[power];
}
template <>
constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
inline constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {

return powers_of_ten_float[power];
}


template <>
constexpr int binary_format<double>::largest_power_of_ten() {
inline constexpr int binary_format<double>::largest_power_of_ten() {
return 308;
}
template <>
constexpr int binary_format<float>::largest_power_of_ten() {
inline constexpr int binary_format<float>::largest_power_of_ten() {
return 38;
}

template <>
constexpr int binary_format<double>::smallest_power_of_ten() {
inline constexpr int binary_format<double>::smallest_power_of_ten() {
return -342;
}
template <>
constexpr int binary_format<float>::smallest_power_of_ten() {
inline constexpr int binary_format<float>::smallest_power_of_ten() {
return -65;
}

Expand Down
4 changes: 3 additions & 1 deletion tests/installation_tests/find/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC_VERSION GREATER 1910)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
endif()
find_package(FastFloat REQUIRED)


Expand Down
4 changes: 3 additions & 1 deletion tests/installation_tests/issue72_installation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC_VERSION GREATER 1910)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
endif()

find_package(FastFloat REQUIRED)

Expand All @@ -20,6 +23,5 @@ int main() { return 0; }")
file(WRITE foo.cpp "
#include \"test.h\"
void foo() { }")

add_executable(issue72 main.cpp main.cpp)
target_link_libraries(issue72 PUBLIC FastFloat::fast_float)

0 comments on commit e3af106

Please sign in to comment.