215 Commits

Author SHA1 Message Date
IRainman
af8ece24d7 Merge branch 'main' of https://github.com/fastfloat/fast_float 2025-09-18 22:10:37 +03:00
Daniel Lemire
e20c952456
Merge pull request #320 from toughengineer/int_multiplication_by_power_of_10
Implemented multiplication of integer by a power of 10
2025-09-18 07:48:09 -06:00
IRainman
af1f8e3ac2 Merge branch 'main' of https://github.com/fastfloat/fast_float 2025-09-16 00:58:58 +03:00
InvalidUsernameException
9d81c71aef Do not mis-parse certain wide-character emojis as integer
When calling ch_to_digit() with a UTF-16 or UTF-32 code unit, it simply
truncates away any data stored in the non-low byte(s) of the code unit.
It then uses a lookup table to determine whether the low byte
corresponds to an ASCII digit. This is incorrect because as soon as any
bit outside the low byte is set, the number will never correspond to a
ASCII digit anymore.

To fix this, we produce a mask that is all zeroes if any bit outside the
low byte is set in the code unit, all ones otherwise. Anding this mask
with the original code unit forces the table lookup to return the
sentinel value from the zero-index if any high bit was set and causes
the code unit not to be parsed as integer.

This bug was discovered when loading Mastodon posts inside the Ladybird
browser where some of Mastodon's JavaScript would trigger the code path
that erroneously parsed the emoji as integer. It had the visible effect
that some digits inside the posts would get rendered as one of the
emojis that parsed to that digit. For more details see this issue:
https://github.com/LadybirdBrowser/ladybird/issues/6205

The emojis in the test case are simply all the emojis used on Mastodon
that caused the bug. They can be found here:
06803422da/app/javascript/mastodon/features/emoji/emoji_map.json
2025-09-15 23:12:28 +02:00
Pavel Novikov
e12463583f
added lacking overloads to avoid potential ambiguity 2025-09-06 00:12:41 +03:00
Pavel Novikov
6702cd4244
added doc section in the README,
added example code test executable
2025-09-05 13:36:23 +03:00
Pavel Novikov
20a7383442
renamed the function, cleaned up return type 2025-09-05 13:36:23 +03:00
Pavel Novikov
763558b9ac
cleaned up tests 2025-09-05 13:34:48 +03:00
Daniel Lemire
42db9ac1de
Merge branch 'main' into P2497R0 2025-09-03 12:04:36 -04:00
Pavel Novikov
cc90f240ee
added some tests 2025-09-02 23:03:38 +03:00
Daniel Lemire
2d2b42bb38 forked doctest 2025-06-03 18:15:52 -04:00
Daniel Lemire
73b27b7d68 hmmm 2025-06-02 09:52:34 -04:00
Daniel Lemire
a1e272f515 lint 2025-05-19 18:16:14 -04:00
Daniel Lemire
0458c20061 adding missing file 2025-05-19 18:09:34 -04:00
Daniel Lemire
81b8306c5f implementation of https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2497r0.html 2025-05-19 18:08:36 -04:00
IRainman
a72afb539f unfck clang format 2025-05-12 16:45:40 +03:00
IRainman
42131710b7 compilation fix for internal tests 2025-05-12 15:28:42 +03:00
IRainman
e5f189754f compilation fixes. 2025-05-06 21:05:05 +03:00
IRainman
99d769db5b clang-format 2025-05-06 18:15:43 +03:00
IRainman
9049a1a511 clang-format. 2025-05-06 14:26:20 +03:00
IRainman
f8625b6416 fix warnings. 2025-04-10 18:45:05 +03:00
IRainman
6cacae0782 trying to fix tests. 2025-04-10 17:37:09 +03:00
IRainman
2da25b51c8 trying to fix tests. 2025-04-10 00:49:16 +03:00
IRainman
cd5db6f5e9 lint 2025-03-12 21:34:31 +03:00
IRainman
c08b7b12a6 tests updated 2025-03-12 21:26:31 +03:00
IRainman
929e98182e lint 2025-03-12 21:13:20 +03:00
IRainman
1ab438cf7a Tests are updated. 2025-03-12 21:03:53 +03:00
Daniel Lemire
95dedd0aed turning json option into macro parameter 2025-03-09 15:13:43 -04:00
Daniel Lemire
717112d257 lint 2025-02-06 20:25:09 -05:00
Daniel Lemire
f0c709e3e4 ignoring failures 2025-02-06 20:24:43 -05:00
Anders Dalvander
f23ced2e4e fix for supplemental 2024-12-04 01:02:20 +01:00
Anders Dalvander
baaf58d2dd fix -Werror=maybe-uninitialized 2024-12-04 00:13:20 +01:00
Anders Dalvander
63bbefad6b templates and types 2024-12-03 23:47:21 +01:00
Anders Dalvander
ac453a091a overly precise tests for imprecise floats 2024-12-03 23:23:35 +01:00
Anders Dalvander
3b9ff76143 duplicate tests for both float and double 2024-12-03 23:23:34 +01:00
Anders Dalvander
c62b853648 float.rounds_to_nearest 2024-12-03 23:23:34 +01:00
Anders Dalvander
b3acae22ea fix parse_zero and parse_negative_zero output 2024-12-03 23:23:34 +01:00
Anders Dalvander
74e00e1401 fix double test in float region in basictest 2024-12-03 23:23:34 +01:00
Anders Dalvander
558bec8b9b fix logging in basictest 2024-12-03 23:23:34 +01:00
Daniel Lemire
6f8fd6728d make it build 2024-12-03 23:23:34 +01:00
Daniel Lemire
c526899951 cleaning. 2024-12-03 23:23:34 +01:00
Daniel Lemire
bfcff49c83 16-bit float support 2024-12-03 23:23:34 +01:00
Anders Dalvander
3775a81ced formatted code 2024-12-01 16:39:28 +01:00
Anders Dalvander
0a1bf11560 harmonize ifdef checks 2024-12-01 16:36:45 +01:00
Anders Dalvander
3146e686d0 introduce equiv_uint_t 2024-12-01 16:36:17 +01:00
Anders Dalvander
396feb6353 add char8_t test 2024-11-25 15:43:51 +01:00
Anders Dalvander
2c4b48d4e0 add unicode_test 2024-11-25 15:39:04 +01:00
Anders Dalvander
1a15c66fb9 harmonize files to use "east const"
manually checked modified files for errors, but not committing .clang-format due to the following warning:
>>> Setting `QualifierAlignment` to something other than `Leave`, COULD lead to incorrect code formatting due to incorrect decisions made due to clang-formats lack of complete semantic information. As such extra care should be taken to review code changes made by the use of this option.
2024-11-23 09:46:18 +01:00
Anders Dalvander
dead62d440 disable test if fast-math is enabled 2024-11-21 00:09:10 +01:00
Anders Dalvander
7ff885d45c fix for is_space for wchar_t and larger char types 2024-11-21 00:09:00 +01:00