mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-11-09 22:59:51 +08:00
Apply clang-format
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3e852fe376
commit
18ee067179
@ -104,10 +104,9 @@ compute_float(int64_t q, uint64_t w) noexcept {
|
|||||||
adjusted_mantissa answer;
|
adjusted_mantissa answer;
|
||||||
// One comparison for both ends of the range, then zero vs infinity without
|
// One comparison for both ends of the range, then zero vs infinity without
|
||||||
// a branch: it follows the sign of the exponent, which is unpredictable.
|
// a branch: it follows the sign of the exponent, which is unpredictable.
|
||||||
bool const q_out_of_range =
|
bool const q_out_of_range = uint64_t(q - binary::smallest_power_of_ten()) >
|
||||||
uint64_t(q - binary::smallest_power_of_ten()) >
|
uint64_t(binary::largest_power_of_ten() -
|
||||||
uint64_t(binary::largest_power_of_ten() -
|
binary::smallest_power_of_ten());
|
||||||
binary::smallest_power_of_ten());
|
|
||||||
if ((w == 0) || q_out_of_range) {
|
if ((w == 0) || q_out_of_range) {
|
||||||
bool const underflow = (w == 0) | (q < binary::smallest_power_of_ten());
|
bool const underflow = (w == 0) | (q < binary::smallest_power_of_ten());
|
||||||
answer.power2 = int32_t(!underflow) * binary::infinite_power();
|
answer.power2 = int32_t(!underflow) * binary::infinite_power();
|
||||||
|
|||||||
@ -458,8 +458,9 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value,
|
|||||||
// Test for over/underflow. One comparison catches both a zero and an
|
// Test for over/underflow. One comparison catches both a zero and an
|
||||||
// infinite exponent, so normal values pay a single, never-taken branch. The
|
// infinite exponent, so normal values pay a single, never-taken branch. The
|
||||||
// result is then selected: which case it is follows the sign of the exponent.
|
// result is then selected: which case it is follows the sign of the exponent.
|
||||||
if fastfloat_clang_unlikely (uint32_t(am.power2 - 1) >=
|
constexpr uint32_t max_power2 =
|
||||||
uint32_t(binary_format<T>::infinite_power() - 1)) {
|
uint32_t(binary_format<T>::infinite_power() - 1);
|
||||||
|
if fastfloat_clang_unlikely (uint32_t(am.power2 - 1) >= max_power2) {
|
||||||
bool const out_of_range =
|
bool const out_of_range =
|
||||||
(am.power2 != 0) | ((am.mantissa == 0) & (pns.mantissa != 0));
|
(am.power2 != 0) | ((am.mantissa == 0) & (pns.mantissa != 0));
|
||||||
answer.ec = out_of_range ? std::errc::result_out_of_range : answer.ec;
|
answer.ec = out_of_range ? std::errc::result_out_of_range : answer.ec;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user