mirror of https://github.com/microsoft/vcpkg.git
[half] Fix literal operator syntax, add test port (#50190)
This commit is contained in:
parent
e8ac0692f3
commit
9fd0ee9e56
|
|
@ -0,0 +1,31 @@
|
|||
diff --git a/include/half.hpp b/include/half.hpp
|
||||
index cb658f2..5c054c6 100644
|
||||
--- a/include/half.hpp
|
||||
+++ b/include/half.hpp
|
||||
@@ -442,7 +442,7 @@ namespace half_float
|
||||
/// ~~~~
|
||||
namespace literal
|
||||
{
|
||||
- half operator "" _h(long double);
|
||||
+ half operator ""_h(long double);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2261,7 +2261,7 @@ namespace half_float
|
||||
friend struct std::hash<half>;
|
||||
#endif
|
||||
#if HALF_ENABLE_CPP11_USER_LITERALS
|
||||
- friend half literal::operator "" _h(long double);
|
||||
+ friend half literal::operator ""_h(long double);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
@@ -2276,7 +2276,7 @@ namespace half_float
|
||||
/// \param value literal value
|
||||
/// \return half with of given value (possibly rounded)
|
||||
/// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
|
||||
- inline half operator "" _h(long double value) { return half(detail::binary, detail::float2half<half::round_style>(value)); }
|
||||
+ inline half operator ""_h(long double value) { return half(detail::binary, detail::float2half<half::round_style>(value)); }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -5,6 +5,8 @@ vcpkg_from_sourceforge(
|
|||
FILENAME "half-${VERSION}.zip"
|
||||
NO_REMOVE_ONE_LEVEL
|
||||
SHA512 946b1663a736eb486f670ba9dfcc56b43b9e7fb195988174b7dd004bdd2e23aba7a395b8867b4f58c97e73a50edf845b703b8cfc35708a562e6a9d7e1b4f4204
|
||||
PATCHES
|
||||
literal_operator.diff
|
||||
)
|
||||
|
||||
file(GLOB HEADER_FILES "${SOURCE_PATH}/include/*.hpp")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "half",
|
||||
"version": "2.2.1",
|
||||
"port-version": 1,
|
||||
"description": "C++ library for half precision floating point arithmetics.",
|
||||
"homepage": "https://sourceforge.net/projects/half/",
|
||||
"license": "MIT"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
)
|
||||
vcpkg_cmake_build()
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(halftest)
|
||||
|
||||
find_path(HALF_INCLUDE_DIRS "half.hpp")
|
||||
add_executable(main main.cpp)
|
||||
target_include_directories(main PRIVATE ${HALF_INCLUDE_DIRS})
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#include <type_traits>
|
||||
|
||||
#include <half.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace half_float::literal;
|
||||
auto x = 2.4_h;
|
||||
static_assert(std::is_same<decltype(x), half_float::half>::value);
|
||||
half_float::half y = half_float::sqrt(x);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "vcpkg-ci-half",
|
||||
"version-string": "ci",
|
||||
"description": "Validation port",
|
||||
"dependencies": [
|
||||
"half",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -3694,7 +3694,7 @@
|
|||
},
|
||||
"half": {
|
||||
"baseline": "2.2.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"halide": {
|
||||
"baseline": "18.0.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "ec987385fe081fb2fbabe52bbd485ce68ce229f4",
|
||||
"version": "2.2.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "cb043c76e364be5e48acaf5ae8d158d632d9ec09",
|
||||
"version": "2.2.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue