mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-09-14 14:42:26 +08:00
Merge branch 'main' of https://github.com/fastfloat/fast_float
This commit is contained in:
commit
42eecf4205
2
.github/workflows/amalgamate-ubuntu24.yml
vendored
2
.github/workflows/amalgamate-ubuntu24.yml
vendored
@ -14,4 +14,4 @@ jobs:
|
||||
python3 ./script/amalgamate.py > build/fast_float/fast_float.h &&
|
||||
cp tests/string_test.cpp build/ &&
|
||||
cd build &&
|
||||
g++ string_test.cpp
|
||||
g++ -Werror=old-style-cast string_test.cpp
|
||||
|
||||
@ -113,10 +113,10 @@ int main() {
|
||||
buf.reserve(N * ip_size);
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
uint8_t a = (uint8_t)dist(rng);
|
||||
uint8_t b = (uint8_t)dist(rng);
|
||||
uint8_t c = (uint8_t)dist(rng);
|
||||
uint8_t d = (uint8_t)dist(rng);
|
||||
uint8_t a = static_cast<uint8_t>(dist(rng));
|
||||
uint8_t b = static_cast<uint8_t>(dist(rng));
|
||||
uint8_t c = static_cast<uint8_t>(dist(rng));
|
||||
uint8_t d = static_cast<uint8_t>(dist(rng));
|
||||
std::string ip_line = make_ip_line(a, b, c, d);
|
||||
ip_line.resize(ip_size, ' '); // pad to fixed size
|
||||
buf.append(ip_line);
|
||||
@ -132,7 +132,7 @@ int main() {
|
||||
std::string buffer(ip_size * N, ' ');
|
||||
|
||||
pretty_print(volume, bytes, "memcpy baseline", counters::bench([&]() {
|
||||
std::memcpy((char *)buffer.data(), buf.data(), bytes);
|
||||
std::memcpy(buffer.data(), buf.data(), bytes);
|
||||
}));
|
||||
|
||||
pretty_print(volume, bytes, "just_seek_ip_end (no parse)",
|
||||
@ -143,7 +143,7 @@ int main() {
|
||||
int ok = 0;
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
const char *q = seek_ip_end(p, pend);
|
||||
sum += (uint32_t)(q - p);
|
||||
sum += static_cast<uint32_t>(q - p);
|
||||
p += ip_size;
|
||||
}
|
||||
sink += sum;
|
||||
|
||||
@ -75,7 +75,7 @@ int main() {
|
||||
buffer.reserve(N * 6); // up to 5 digits + delimiter
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
uint16_t val = (uint16_t)dist(rng);
|
||||
uint16_t val = static_cast<uint16_t>(dist(rng));
|
||||
expected.push_back(val);
|
||||
std::string s = std::to_string(val);
|
||||
buffer.append(s);
|
||||
|
||||
@ -623,8 +623,8 @@ struct bigint : pow5_tables<> {
|
||||
// Work around clang bug https://godbolt.org/z/zedh7rrhc
|
||||
// This is similar to https://github.com/llvm/llvm-project/issues/47746,
|
||||
// except the workaround described there don't work here
|
||||
FASTFLOAT_TRY(small_mul(
|
||||
vec, limb(((void)small_power_of_5[0], small_power_of_5[exp]))));
|
||||
FASTFLOAT_TRY(small_mul(vec, limb((static_cast<void>(small_power_of_5[0]),
|
||||
small_power_of_5[exp]))));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -403,8 +403,8 @@ negative_digit_comp(bigint &real_digits, adjusted_mantissa am,
|
||||
round<T>(am, [ord](adjusted_mantissa &a, am_pow_t shift) {
|
||||
round_nearest_tie_even(
|
||||
a, shift, [ord](bool is_odd, bool _, bool __) -> bool {
|
||||
(void)_; // not needed, since we've done our comparison
|
||||
(void)__; // not needed, since we've done our comparison
|
||||
static_cast<void>(_); // not needed, since we've done our comparison
|
||||
static_cast<void>(__); // not needed, since we've done our comparison
|
||||
if (ord > 0) {
|
||||
return true;
|
||||
} else if (ord < 0) {
|
||||
|
||||
@ -49,7 +49,7 @@ function(fast_float_add_cpp_test TEST_NAME)
|
||||
target_compile_options(${TEST_NAME} PUBLIC /EHsc)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
target_compile_options(${TEST_NAME} PUBLIC -Werror -Wall -Wextra -Weffc++)
|
||||
target_compile_options(${TEST_NAME} PUBLIC -Werror -Wall -Wextra -Weffc++ -Wold-style-cast)
|
||||
target_compile_options(${TEST_NAME} PUBLIC -Wsign-compare -Wshadow -Wwrite-strings -Wpointer-arith -Winit-self -Wconversion -Wsign-conversion)
|
||||
endif()
|
||||
target_link_libraries(${TEST_NAME} PUBLIC fast_float supplemental-data)
|
||||
|
||||
@ -1061,7 +1061,7 @@ void basic_test(float val) {
|
||||
do { \
|
||||
constexpr int verify_comptime_var = \
|
||||
(basic_test<Diag::comptime>(__VA_ARGS__), 0); \
|
||||
(void)verify_comptime_var; \
|
||||
static_cast<void>(verify_comptime_var); \
|
||||
} while (false)
|
||||
|
||||
#define verify_options_runtime(...) \
|
||||
@ -1073,7 +1073,7 @@ void basic_test(float val) {
|
||||
do { \
|
||||
constexpr int verify_options_comptime_var = \
|
||||
(basic_test<Diag::comptime>(__VA_ARGS__, options), 0); \
|
||||
(void)verify_options_comptime_var; \
|
||||
static_cast<void>(verify_options_comptime_var); \
|
||||
} while (false)
|
||||
|
||||
#if defined(FASTFLOAT_CONSTEXPR_TESTS)
|
||||
|
||||
@ -61,7 +61,7 @@ template <typename T> char *to_string(T d, char *buffer) {
|
||||
}
|
||||
|
||||
void strtof_from_string(char const *st, float &d) {
|
||||
char *pr = (char *)st;
|
||||
char *pr = const_cast<char *>(st);
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || \
|
||||
defined(sun) || defined(__sun)
|
||||
d = cygwin_strtof_l(st, &pr);
|
||||
|
||||
@ -125,7 +125,7 @@ template <typename T> bool test() {
|
||||
template <typename T> void strtod_from_string(std::string const &st, T &d);
|
||||
|
||||
template <> void strtod_from_string(std::string const &st, double &d) {
|
||||
char *pr = (char *)st.c_str();
|
||||
char *pr = const_cast<char *>(st.c_str());
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || \
|
||||
defined(sun) || defined(__sun)
|
||||
d = cygwin_strtod_l(pr, &pr);
|
||||
@ -142,7 +142,7 @@ template <> void strtod_from_string(std::string const &st, double &d) {
|
||||
}
|
||||
|
||||
template <> void strtod_from_string(std::string const &st, float &d) {
|
||||
char *pr = (char *)st.c_str();
|
||||
char *pr = const_cast<char *>(st.c_str());
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || \
|
||||
defined(sun) || defined(__sun)
|
||||
d = cygwin_strtof_l(st.c_str(), &pr);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user