Skip to content

Commit 0ba2ba6

Browse files
committed
Add missing files to src/CMakeLists.txt.
1 parent 1492787 commit 0ba2ba6

3 files changed

Lines changed: 92 additions & 114 deletions

File tree

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ set(CAT_HEADER_FILES
155155
${CATLIB}/allocator/cat/pool_allocator
156156
${CATLIB}/arithmetic/cat/arithmetic
157157
${CATLIB}/arithmetic/cat/overflow_reference.hpp
158+
${CATLIB}/arithmetic/cat/precision_reference.hpp
158159
${CATLIB}/arithmetic/cat/arithmetic_interface
159160
${CATLIB}/array/cat/array
160161
${CATLIB}/atomic/cat/atomic
@@ -206,6 +207,8 @@ set(CAT_HEADER_FILES
206207
${CATLIB}/scaredy/cat/scaredy
207208
${CATLIB}/simd/cat/simd
208209
${CATLIB}/simd/cat/detail/simd_overflow_reference.hpp
210+
${CATLIB}/simd/cat/detail/simd_precision_policy.hpp
211+
${CATLIB}/simd/cat/detail/simd_precision_reference.hpp
209212
${CATLIB}/simd/cat/detail/simd_abi_hooks.hpp
210213
${CATLIB}/simd/cat/detail/simd_extras.hpp
211214
${CATLIB}/simd/cat/detail/simd_impl.hpp

src/libraries/arithmetic/cat/precision_reference.hpp

Lines changed: 53 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ namespace detail {
1111
template <typename T, precision_policies fallback>
1212
inline constexpr precision_policies float_precision_for = fallback;
1313

14-
template <typename T, precision_policies precision,
15-
precision_policies fallback>
14+
template <typename T, precision_policies precision, precision_policies fallback>
1615
inline constexpr precision_policies
1716
float_precision_for<basic_float<T, precision>, fallback> = precision;
1817

1918
template <typename T, typename U, precision_policies precision>
20-
using precision_reference_reverse_result = basic_float<
21-
common_type<raw_arithmetic_type<T>, raw_arithmetic_type<U>>,
22-
float_precision_for<remove_cvref<T>, precision>>;
19+
using precision_reference_reverse_result =
20+
basic_float<common_type<raw_arithmetic_type<T>, raw_arithmetic_type<U>>,
21+
float_precision_for<remove_cvref<T>, precision>>;
2322

2423
} // namespace detail
2524

@@ -64,8 +63,7 @@ class precision_reference {
6463
[[gnu::always_inline, gnu::nodebug]]
6564
constexpr auto
6665
precise() && -> basic_float<raw_type, precision_policies::precise> {
67-
return basic_float<raw_type, precision_policies::precise>(
68-
m_wrapped->raw);
66+
return basic_float<raw_type, precision_policies::precise>(m_wrapped->raw);
6967
}
7068

7169
constexpr auto
@@ -105,11 +103,10 @@ class precision_reference {
105103
template <typename OtherWrappedQual, precision_policies other_precision>
106104
[[nodiscard, gnu::always_inline, gnu::nodebug]]
107105
constexpr auto
108-
operator<=>(
109-
precision_reference<OtherWrappedQual, other_precision> rhs) const
106+
operator<=>(precision_reference<OtherWrappedQual, other_precision> rhs) const
110107
-> std::partial_ordering {
111-
using other_raw_type = precision_reference<
112-
OtherWrappedQual, other_precision>::raw_type;
108+
using other_raw_type =
109+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
113110
using common = common_type<raw_type, other_raw_type>;
114111
return detail::float_compare_three_way<precision>(
115112
common(m_wrapped->raw), common(rhs.m_wrapped->raw));
@@ -129,11 +126,11 @@ class precision_reference {
129126
operator==(precision_reference lhs,
130127
precision_reference<OtherWrappedQual, other_precision> rhs)
131128
-> bool {
132-
using other_raw_type = precision_reference<
133-
OtherWrappedQual, other_precision>::raw_type;
129+
using other_raw_type =
130+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
134131
using common = common_type<raw_type, other_raw_type>;
135-
return detail::float_equal<precision>(
136-
common(lhs.m_wrapped->raw), common(rhs.m_wrapped->raw));
132+
return detail::float_equal<precision>(common(lhs.m_wrapped->raw),
133+
common(rhs.m_wrapped->raw));
137134
}
138135

139136
template <is_arithmetic U>
@@ -158,17 +155,16 @@ class precision_reference {
158155
[[nodiscard, gnu::always_inline, gnu::nodebug]]
159156
constexpr auto
160157
add(precision_reference<OtherWrappedQual, other_precision> other) const
161-
-> basic_float<common_type<
162-
raw_type,
163-
typename precision_reference<
164-
OtherWrappedQual, other_precision>::raw_type>,
165-
precision> {
166-
using other_raw_type = precision_reference<
167-
OtherWrappedQual, other_precision>::raw_type;
158+
-> basic_float<
159+
common_type<raw_type, typename precision_reference<
160+
OtherWrappedQual, other_precision>::raw_type>,
161+
precision> {
162+
using other_raw_type =
163+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
168164
using result_type =
169165
basic_float<common_type<raw_type, other_raw_type>, precision>;
170-
return result_type(detail::float_add<precision>(
171-
m_wrapped->raw, other.m_wrapped->raw));
166+
return result_type(
167+
detail::float_add<precision>(m_wrapped->raw, other.m_wrapped->raw));
172168
}
173169

174170
template <is_arithmetic U>
@@ -182,15 +178,13 @@ class precision_reference {
182178
template <typename OtherWrappedQual, precision_policies other_precision>
183179
[[nodiscard, gnu::always_inline, gnu::nodebug]]
184180
constexpr auto
185-
subtract_by(
186-
precision_reference<OtherWrappedQual, other_precision> operand) const
187-
-> basic_float<common_type<
188-
raw_type,
189-
typename precision_reference<
190-
OtherWrappedQual, other_precision>::raw_type>,
191-
precision> {
192-
using other_raw_type = precision_reference<
193-
OtherWrappedQual, other_precision>::raw_type;
181+
subtract_by(precision_reference<OtherWrappedQual, other_precision> operand)
182+
const -> basic_float<
183+
common_type<raw_type, typename precision_reference<
184+
OtherWrappedQual, other_precision>::raw_type>,
185+
precision> {
186+
using other_raw_type =
187+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
194188
using result_type =
195189
basic_float<common_type<raw_type, other_raw_type>, precision>;
196190
return result_type(detail::float_subtract<precision>(
@@ -223,12 +217,11 @@ class precision_reference {
223217
constexpr auto
224218
multiply(precision_reference<OtherWrappedQual, other_precision> operand)
225219
const -> basic_float<
226-
common_type<raw_type,
227-
typename precision_reference<
228-
OtherWrappedQual, other_precision>::raw_type>,
220+
common_type<raw_type, typename precision_reference<
221+
OtherWrappedQual, other_precision>::raw_type>,
229222
precision> {
230-
using other_raw_type = precision_reference<
231-
OtherWrappedQual, other_precision>::raw_type;
223+
using other_raw_type =
224+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
232225
using result_type =
233226
basic_float<common_type<raw_type, other_raw_type>, precision>;
234227
return result_type(detail::float_multiply<precision>(
@@ -248,12 +241,11 @@ class precision_reference {
248241
constexpr auto
249242
divide_by(precision_reference<OtherWrappedQual, other_precision> operand)
250243
const -> basic_float<
251-
common_type<raw_type,
252-
typename precision_reference<
253-
OtherWrappedQual, other_precision>::raw_type>,
244+
common_type<raw_type, typename precision_reference<
245+
OtherWrappedQual, other_precision>::raw_type>,
254246
precision> {
255-
using other_raw_type = precision_reference<
256-
OtherWrappedQual, other_precision>::raw_type;
247+
using other_raw_type =
248+
precision_reference<OtherWrappedQual, other_precision>::raw_type;
257249
using result_type =
258250
basic_float<common_type<raw_type, other_raw_type>, precision>;
259251
return result_type(detail::float_divide<precision>(
@@ -275,8 +267,8 @@ class precision_reference {
275267

276268
template <typename U>
277269
requires(requires(precision_reference lhs, U&& rhs) {
278-
lhs.add(static_cast<U&&>(rhs));
279-
})
270+
lhs.add(static_cast<U&&>(rhs));
271+
})
280272
[[nodiscard, gnu::always_inline, gnu::nodebug]]
281273
friend constexpr auto
282274
operator+(precision_reference lhs, U&& rhs)
@@ -288,15 +280,14 @@ class precision_reference {
288280
requires(is_floating_point<U>)
289281
[[nodiscard, gnu::always_inline, gnu::nodebug]]
290282
friend constexpr auto
291-
operator+(U lhs, precision_reference rhs)
292-
-> decltype(rhs.add(lhs)) {
283+
operator+(U lhs, precision_reference rhs) -> decltype(rhs.add(lhs)) {
293284
return rhs.add(lhs);
294285
}
295286

296287
template <typename U>
297288
requires(requires(precision_reference lhs, U&& rhs) {
298-
lhs.subtract_by(static_cast<U&&>(rhs));
299-
})
289+
lhs.subtract_by(static_cast<U&&>(rhs));
290+
})
300291
[[nodiscard, gnu::always_inline, gnu::nodebug]]
301292
friend constexpr auto
302293
operator-(precision_reference lhs, U&& rhs)
@@ -315,8 +306,8 @@ class precision_reference {
315306

316307
template <typename U>
317308
requires(requires(precision_reference lhs, U&& rhs) {
318-
lhs.multiply(static_cast<U&&>(rhs));
319-
})
309+
lhs.multiply(static_cast<U&&>(rhs));
310+
})
320311
[[nodiscard, gnu::always_inline, gnu::nodebug]]
321312
friend constexpr auto
322313
operator*(precision_reference lhs, U&& rhs)
@@ -328,15 +319,14 @@ class precision_reference {
328319
requires(is_floating_point<U>)
329320
[[nodiscard, gnu::always_inline, gnu::nodebug]]
330321
friend constexpr auto
331-
operator*(U lhs, precision_reference rhs)
332-
-> decltype(rhs.multiply(lhs)) {
322+
operator*(U lhs, precision_reference rhs) -> decltype(rhs.multiply(lhs)) {
333323
return rhs.multiply(lhs);
334324
}
335325

336326
template <typename U>
337327
requires(requires(precision_reference lhs, U&& rhs) {
338-
lhs.divide_by(static_cast<U&&>(rhs));
339-
})
328+
lhs.divide_by(static_cast<U&&>(rhs));
329+
})
340330
[[nodiscard, gnu::always_inline, gnu::nodebug]]
341331
friend constexpr auto
342332
operator/(precision_reference lhs, U&& rhs)
@@ -355,8 +345,8 @@ class precision_reference {
355345

356346
template <is_arithmetic U>
357347
requires(!is_const<WrappedQual>
358-
&& is_same<remove_cvref<decltype(declval<
359-
precision_reference&>().add(declval<U>()))>,
348+
&& is_same<remove_cvref<decltype(declval<precision_reference&>()
349+
.add(declval<U>()))>,
360350
basic_float<raw_type, precision>>)
361351
[[gnu::always_inline, gnu::nodebug]]
362352
constexpr auto
@@ -367,9 +357,8 @@ class precision_reference {
367357

368358
template <is_arithmetic U>
369359
requires(!is_const<WrappedQual>
370-
&& is_same<remove_cvref<decltype(
371-
declval<precision_reference&>().subtract_by(
372-
declval<U>()))>,
360+
&& is_same<remove_cvref<decltype(declval<precision_reference&>()
361+
.subtract_by(declval<U>()))>,
373362
basic_float<raw_type, precision>>)
374363
[[gnu::always_inline, gnu::nodebug]]
375364
constexpr auto
@@ -380,8 +369,8 @@ class precision_reference {
380369

381370
template <is_arithmetic U>
382371
requires(!is_const<WrappedQual>
383-
&& is_same<remove_cvref<decltype(declval<
384-
precision_reference&>().multiply(declval<U>()))>,
372+
&& is_same<remove_cvref<decltype(declval<precision_reference&>()
373+
.multiply(declval<U>()))>,
385374
basic_float<raw_type, precision>>)
386375
[[gnu::always_inline, gnu::nodebug]]
387376
constexpr auto
@@ -392,8 +381,8 @@ class precision_reference {
392381

393382
template <is_arithmetic U>
394383
requires(!is_const<WrappedQual>
395-
&& is_same<remove_cvref<decltype(declval<
396-
precision_reference&>().divide_by(declval<U>()))>,
384+
&& is_same<remove_cvref<decltype(declval<precision_reference&>()
385+
.divide_by(declval<U>()))>,
397386
basic_float<raw_type, precision>>)
398387
[[gnu::always_inline, gnu::nodebug]]
399388
constexpr auto

0 commit comments

Comments
 (0)