Skip to content

Commit 4ca0df8

Browse files
committed
isolate clang crutch.
1 parent 4a0bd5e commit 4ca0df8

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

include/fast_float/float_common.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,39 +1154,51 @@ inline constexpr am_mant_t
11541154
binary_format<double>::max_mantissa_fast_path(am_pow_t power) {
11551155
// caller is responsible to ensure that
11561156
FASTFLOAT_ASSUME(power >= 0 && power <= 22);
1157-
//
1158-
// Work around clang and gcc bug https://godbolt.org/z/zedh7rrhc
1157+
#if defined(__clang__)
1158+
// Work around clang bug https://godbolt.org/z/zedh7rrhc
11591159
return (void)max_mantissa[0], max_mantissa[power];
1160+
#else
1161+
return max_mantissa[power];
1162+
#endif
11601163
}
11611164

11621165
template <>
11631166
inline constexpr am_mant_t
11641167
binary_format<float>::max_mantissa_fast_path(am_pow_t power) {
11651168
// caller is responsible to ensure that
11661169
FASTFLOAT_ASSUME(power >= 0 && power <= 10);
1167-
//
1168-
// Work around clang and gcc bug https://godbolt.org/z/zedh7rrhc
1170+
#if defined(__clang__)
1171+
// Work around clang bug https://godbolt.org/z/zedh7rrhc
11691172
return (void)max_mantissa[0], max_mantissa[power];
1173+
#else
1174+
return max_mantissa[power];
1175+
#endif
11701176
}
11711177

11721178
template <>
11731179
inline constexpr double
11741180
binary_format<double>::exact_power_of_ten(am_pow_t power) {
11751181
// caller is responsible to ensure that
11761182
FASTFLOAT_ASSUME(power >= 0 && power <= 22);
1177-
//
1178-
// Work around clang and gcc bug https://godbolt.org/z/zedh7rrhc
1183+
#if defined(__clang__)
1184+
// Work around clang bug https://godbolt.org/z/zedh7rrhc
11791185
return (void)powers_of_ten[0], powers_of_ten[power];
1186+
#else
1187+
return powers_of_ten[power];
1188+
#endif
11801189
}
11811190

11821191
template <>
11831192
inline constexpr float
11841193
binary_format<float>::exact_power_of_ten(am_pow_t power) {
11851194
// caller is responsible to ensure that
11861195
FASTFLOAT_ASSUME(power >= 0 && power <= 10);
1187-
//
1188-
// Work around clang and gcc bug https://godbolt.org/z/zedh7rrhc
1196+
#if defined(__clang__)
1197+
// Work around clang bug https://godbolt.org/z/zedh7rrhc
11891198
return (void)powers_of_ten[0], powers_of_ten[power];
1199+
#else
1200+
return powers_of_ten[power];
1201+
#endif
11901202
}
11911203

11921204
template <>

0 commit comments

Comments
 (0)