diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-02-03 14:52:43 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-02-03 16:34:24 +0000 |
commit | 36e57486f01fc026fd1e8886b32f91e385befedc (patch) | |
tree | 43c2cf9f99e70539aea65c7b889427fd84a4270e /include | |
parent | d9c24f4fea589ab65a6046769c0642206557e60d (diff) | |
download | mupdf-36e57486f01fc026fd1e8886b32f91e385befedc.tar.xz |
Bug 696546: Add fast strtof
Take on a (slightly tweaked) version of Simon Reinhardt's
patch.
The actual logic is left entirely unchanged; minor changes
have been made to the names of functions/types to avoid
clashing in the cmapdump.c repeated inclusion.
Currently this should really only affect xps files, as strtof
is only used as fz_atof, and that's (effectively) all xps for
now.
I will look at updating lex_number to call this in future.
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/fitz/string.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/mupdf/fitz/string.h b/include/mupdf/fitz/string.h index 0c1789bc..878610e2 100644 --- a/include/mupdf/fitz/string.h +++ b/include/mupdf/fitz/string.h @@ -103,11 +103,22 @@ int fz_runetochar(char *str, int rune); int fz_runelen(int rune); /* - fz_strtod: Locale-independent implementation of strtod(). + fz_strtod/fz_strtof: Locale-independent decimal to binary + conversion. On overflow return (-)INFINITY and set errno to ERANGE. On + underflow return 0 and set errno to ERANGE. Special inputs (case + insensitive): "NAN", "INF" or "INFINITY". */ double fz_strtod(const char *s, char **es); +float fz_strtof(const char *s, char **es); /* + fz_strtof_no_exp: Like fz_strtof, but does not recognize exponent + format. So fz_strtof_no_exp("1.5e20", &tail) will return 1.5 and tail + will point to "e20". +*/ + +float fz_strtof_no_exp(const char *string, char **tailptr); +/* fz_grisu: Compute decimal integer m, exp such that: f = m * 10^exp m is as short as possible without losing exactness |