Skip to content

Commit b57ec06

Browse files
authored
Merge pull request #379 from mlippautz/patch-1
Replace std::min with ternary operators to avoid <algorithm> dependency
2 parents d7ad33a + 001c04c commit b57ec06

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

include/fast_float/ascii_number.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
594594
((digits + 0x46464646u) | (digits - 0x30303030u)) & 0x80808080u;
595595
uint32_t tz = (uint32_t)countr_zero_32(magic); // 7, 15, 23, 31, or 32
596596
uint32_t nd = (tz == 32) ? 4 : (tz >> 3);
597-
nd = (uint32_t)std::min((size_t)nd, len);
597+
nd = (uint32_t)(nd < len ? nd : len);
598598
if (nd == 0) {
599599
if (has_leading_zeros) {
600600
value = 0;

include/fast_float/digit_comparison.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef FASTFLOAT_DIGIT_COMPARISON_H
22
#define FASTFLOAT_DIGIT_COMPARISON_H
33

4-
#include <algorithm>
54
#include <cstdint>
65
#include <cstring>
76
#include <iterator>
@@ -109,7 +108,7 @@ fastfloat_really_inline FASTFLOAT_CONSTEXPR14 void round(adjusted_mantissa &am,
109108
if (-am.power2 >= mantissa_shift) {
110109
// have a denormal float
111110
int32_t shift = -am.power2 + 1;
112-
cb(am, std::min<int32_t>(shift, 64));
111+
cb(am, (shift < 64 ? shift : 64));
113112
// check for round-up: if rounding-nearest carried us to the hidden bit.
114113
am.power2 = (am.mantissa <
115114
(uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))

include/fast_float/float_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase,
398398
size_t sz{8 / (sizeof(UC))};
399399
for (size_t i = 0; i < length; i += sz) {
400400
val1 = val2 = 0;
401-
sz = std::min(sz, length - i);
401+
sz = sz < (length - i) ? sz : length - i;
402402
::memcpy(&val1, actual_mixedcase + i, sz * sizeof(UC));
403403
::memcpy(&val2, expected_lowercase + i, sz * sizeof(UC));
404404
val1 |= mask;

0 commit comments

Comments
 (0)