mozilla.patch (2465B)
1 diff --git a/hwy/aligned_allocator.h b/hwy/aligned_allocator.h 2 --- a/hwy/aligned_allocator.h 3 +++ b/hwy/aligned_allocator.h 4 @@ -32,6 +32,8 @@ 5 #include "hwy/base.h" 6 #include "hwy/per_target.h" 7 8 +#include <mozilla/Attributes.h> 9 + 10 namespace hwy { 11 12 // Minimum alignment of allocated memory for use in HWY_ASSUME_ALIGNED, which 13 @@ -272,8 +274,8 @@ class Span { 14 Span() = default; 15 Span(T* data, size_t size) : size_(size), data_(data) {} 16 template <typename U> 17 - Span(U u) : Span(u.data(), u.size()) {} 18 - Span(std::initializer_list<const T> v) : Span(v.begin(), v.size()) {} 19 + MOZ_IMPLICIT Span(U u) : Span(u.data(), u.size()) {} 20 + MOZ_IMPLICIT Span(std::initializer_list<const T> v) : Span(v.begin(), v.size()) {} 21 22 // Copies the contents of the initializer list to the span. 23 Span<T>& operator=(std::initializer_list<const T> v) { 24 diff --git a/hwy/base.h b/hwy/base.h 25 --- a/hwy/base.h 26 +++ b/hwy/base.h 27 @@ -33,6 +33,8 @@ 28 #include "hwy/detect_compiler_arch.h" 29 #include "hwy/highway_export.h" 30 31 +#include <mozilla/Attributes.h> 32 + 33 // API version (https://semver.org/); keep in sync with CMakeLists.txt and 34 // meson.build. 35 #define HWY_MAJOR 1 36 @@ -1283,7 +1285,7 @@ struct alignas(2) float16_t { 37 #if HWY_HAVE_SCALAR_F16_TYPE 38 // NEON vget/set_lane intrinsics and SVE `svaddv` could use explicit 39 // float16_t(intrinsic()), but user code expects implicit conversions. 40 - constexpr float16_t(Native arg) noexcept : native(arg) {} 41 + MOZ_IMPLICIT constexpr float16_t(Native arg) noexcept : native(arg) {} 42 constexpr operator Native() const noexcept { return native; } 43 #endif 44 45 @@ -1310,7 +1312,7 @@ struct alignas(2) float16_t { 46 #if HWY_HAVE_SCALAR_F16_OPERATORS || HWY_IDE 47 template <typename T, hwy::EnableIf<!IsSame<RemoveCvRef<T>, float16_t>() && 48 IsConvertible<T, Native>()>* = nullptr> 49 - constexpr float16_t(T&& arg) noexcept 50 + MOZ_IMPLICIT constexpr float16_t(T&& arg) noexcept 51 : native(static_cast<Native>(static_cast<T&&>(arg))) {} 52 53 template <typename T, hwy::EnableIf<!IsSame<RemoveCvRef<T>, float16_t>() && 54 @@ -1769,7 +1771,7 @@ struct alignas(2) bfloat16_t { 55 56 // Only enable implicit conversions if we have a native type. 57 #if HWY_HAVE_SCALAR_BF16_TYPE || HWY_IDE 58 - constexpr bfloat16_t(Native arg) noexcept : native(arg) {} 59 + MOZ_IMPLICIT constexpr bfloat16_t(Native arg) noexcept : native(arg) {} 60 constexpr operator Native() const noexcept { return native; } 61 #endif