mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-04-30 19:09:19 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05087a303d | ||
|
|
b2b1e203ba | ||
|
|
b57ec064ad | ||
|
|
001c04cc8a | ||
|
|
b063de82c7 | ||
|
|
d7ad33a80e | ||
|
|
2027a39ba0 | ||
|
|
9817d5ddaa | ||
|
|
7124634005 | ||
|
|
419695eba6 | ||
|
|
18e55e48a8 |
2
.github/workflows/cifuzz.yml
vendored
2
.github/workflows/cifuzz.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
fuzz-seconds: 300
|
||||
output-sarif: true
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v6
|
||||
uses: actions/upload-artifact@v7
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
with:
|
||||
name: artifacts
|
||||
|
||||
2
.github/workflows/emscripten.yml
vendored
2
.github/workflows/emscripten.yml
vendored
@ -5,7 +5,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.2.2
|
||||
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
- uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
|
||||
- name: Verify
|
||||
run: emcc -v
|
||||
|
||||
2
.github/workflows/lint_and_format_check.yml
vendored
2
.github/workflows/lint_and_format_check.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
||||
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.1.7
|
||||
|
||||
- name: Run clang-format
|
||||
uses: jidicula/clang-format-action@6cd220de46c89139a0365edae93eee8eb30ca8fe # v4.16.0
|
||||
uses: jidicula/clang-format-action@3a18028048f01a66653b4e3bf8d968d2e7e2cb8b # v4.17.0
|
||||
with:
|
||||
clang-format-version: '17'
|
||||
|
||||
|
||||
3
.github/workflows/msys2-clang.yml
vendored
3
.github/workflows/msys2-clang.yml
vendored
@ -16,9 +16,6 @@ jobs:
|
||||
- msystem: "MINGW64"
|
||||
install: mingw-w64-x86_64-libxml2 mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-clang
|
||||
type: Release
|
||||
- msystem: "MINGW32"
|
||||
install: mingw-w64-i686-libxml2 mingw-w64-i686-cmake mingw-w64-i686-ninja mingw-w64-i686-clang
|
||||
type: Release
|
||||
env:
|
||||
CMAKE_GENERATOR: Ninja
|
||||
|
||||
|
||||
6
.github/workflows/msys2.yml
vendored
6
.github/workflows/msys2.yml
vendored
@ -16,15 +16,9 @@ jobs:
|
||||
- msystem: "MINGW64"
|
||||
install: mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc
|
||||
type: Release
|
||||
- msystem: "MINGW32"
|
||||
install: mingw-w64-i686-cmake mingw-w64-i686-ninja mingw-w64-i686-gcc
|
||||
type: Release
|
||||
- msystem: "MINGW64"
|
||||
install: mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc
|
||||
type: Debug
|
||||
- msystem: "MINGW32"
|
||||
install: mingw-w64-i686-cmake mingw-w64-i686-ninja mingw-w64-i686-gcc
|
||||
type: Debug
|
||||
env:
|
||||
CMAKE_GENERATOR: Ninja
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
|
||||
cc_library(
|
||||
name = "fast_float",
|
||||
hdrs = glob(["include/fast_float/*.h"]),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
|
||||
project(fast_float VERSION 8.2.4 LANGUAGES CXX)
|
||||
project(fast_float VERSION 8.2.5 LANGUAGES CXX)
|
||||
set(FASTFLOAT_CXX_STANDARD 11 CACHE STRING "the C++ standard to use for fastfloat")
|
||||
set(CMAKE_CXX_STANDARD ${FASTFLOAT_CXX_STANDARD})
|
||||
option(FASTFLOAT_TEST "Enable tests" OFF)
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
|
||||
module(
|
||||
name = "fast_float",
|
||||
version = "6.1.6",
|
||||
compatibility_level = 6,
|
||||
version = "8.2.4",
|
||||
compatibility_level = 8,
|
||||
)
|
||||
|
||||
bazel_dep(name = "doctest", version = "2.4.11", dev_dependency = True)
|
||||
|
||||
bazel_dep(name = "rules_cc", version = "0.2.17")
|
||||
|
||||
@ -541,7 +541,7 @@ sufficiently recent version of CMake (3.11 or better at least):
|
||||
FetchContent_Declare(
|
||||
fast_float
|
||||
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
|
||||
GIT_TAG tags/v8.2.4
|
||||
GIT_TAG tags/v8.2.5
|
||||
GIT_SHALLOW TRUE)
|
||||
|
||||
FetchContent_MakeAvailable(fast_float)
|
||||
@ -557,7 +557,7 @@ You may also use [CPM](https://github.com/cpm-cmake/CPM.cmake), like so:
|
||||
CPMAddPackage(
|
||||
NAME fast_float
|
||||
GITHUB_REPOSITORY "fastfloat/fast_float"
|
||||
GIT_TAG v8.2.4)
|
||||
GIT_TAG v8.2.5)
|
||||
```
|
||||
|
||||
## Using as single header
|
||||
@ -569,7 +569,7 @@ if desired as described in the command line help.
|
||||
|
||||
You may directly download automatically generated single-header files:
|
||||
|
||||
<https://github.com/fastfloat/fast_float/releases/download/v8.2.4/fast_float.h>
|
||||
<https://github.com/fastfloat/fast_float/releases/download/v8.2.5/fast_float.h>
|
||||
|
||||
## Benchmarking
|
||||
|
||||
|
||||
@ -594,7 +594,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
|
||||
((digits + 0x46464646u) | (digits - 0x30303030u)) & 0x80808080u;
|
||||
uint32_t tz = (uint32_t)countr_zero_32(magic); // 7, 15, 23, 31, or 32
|
||||
uint32_t nd = (tz == 32) ? 4 : (tz >> 3);
|
||||
nd = (uint32_t)std::min((size_t)nd, len);
|
||||
nd = (uint32_t)(nd < len ? nd : len);
|
||||
if (nd == 0) {
|
||||
if (has_leading_zeros) {
|
||||
value = 0;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef FASTFLOAT_DIGIT_COMPARISON_H
|
||||
#define FASTFLOAT_DIGIT_COMPARISON_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
@ -109,7 +108,7 @@ fastfloat_really_inline FASTFLOAT_CONSTEXPR14 void round(adjusted_mantissa &am,
|
||||
if (-am.power2 >= mantissa_shift) {
|
||||
// have a denormal float
|
||||
int32_t shift = -am.power2 + 1;
|
||||
cb(am, std::min<int32_t>(shift, 64));
|
||||
cb(am, (shift < 64 ? shift : 64));
|
||||
// check for round-up: if rounding-nearest carried us to the hidden bit.
|
||||
am.power2 = (am.mantissa <
|
||||
(uint64_t(1) << binary_format<T>::mantissa_explicit_bits()))
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
#define FASTFLOAT_VERSION_MAJOR 8
|
||||
#define FASTFLOAT_VERSION_MINOR 2
|
||||
#define FASTFLOAT_VERSION_PATCH 4
|
||||
#define FASTFLOAT_VERSION_PATCH 5
|
||||
|
||||
#define FASTFLOAT_STRINGIZE_IMPL(x) #x
|
||||
#define FASTFLOAT_STRINGIZE(x) FASTFLOAT_STRINGIZE_IMPL(x)
|
||||
@ -398,7 +398,7 @@ fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase,
|
||||
size_t sz{8 / (sizeof(UC))};
|
||||
for (size_t i = 0; i < length; i += sz) {
|
||||
val1 = val2 = 0;
|
||||
sz = std::min(sz, length - i);
|
||||
sz = sz < (length - i) ? sz : length - i;
|
||||
::memcpy(&val1, actual_mixedcase + i, sz * sizeof(UC));
|
||||
::memcpy(&val2, expected_lowercase + i, sz * sizeof(UC));
|
||||
val1 |= mask;
|
||||
|
||||
@ -155,7 +155,7 @@ template <> struct from_chars_caller<std::float32_t> {
|
||||
// if std::float32_t is defined, and we are in C++23 mode; macro set for
|
||||
// float32; set value to float due to equivalence between float and
|
||||
// float32_t
|
||||
float val;
|
||||
float val = 0.0f;
|
||||
auto ret = from_chars_advanced(first, last, val, options);
|
||||
value = val;
|
||||
return ret;
|
||||
@ -172,7 +172,7 @@ template <> struct from_chars_caller<std::float64_t> {
|
||||
// if std::float64_t is defined, and we are in C++23 mode; macro set for
|
||||
// float64; set value as double due to equivalence between double and
|
||||
// float64_t
|
||||
double val;
|
||||
double val = 0.0;
|
||||
auto ret = from_chars_advanced(first, last, val, options);
|
||||
value = val;
|
||||
return ret;
|
||||
@ -456,8 +456,7 @@ template <size_t TypeIx> struct from_chars_advanced_caller {
|
||||
|
||||
template <> struct from_chars_advanced_caller<1> {
|
||||
template <typename T, typename UC>
|
||||
fastfloat_really_inline
|
||||
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
||||
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
||||
call(UC const *first, UC const *last, T &value,
|
||||
parse_options_t<UC> options) noexcept {
|
||||
return from_chars_float_advanced(first, last, value, options);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user