aboutsummaryrefslogtreecommitdiff
path: root/fpconv.h
diff options
context:
space:
mode:
authorlijunlong <lijunlong@openresty.com>2023-02-22 21:34:30 +0800
committerGitHub <noreply@github.com>2023-02-22 21:34:30 +0800
commit41eee7406b0f048392168515b09e7d8bdd000624 (patch)
tree987f37890364caf90a1229113b7ba80a9c8ca185 /fpconv.h
parentde93a78d3002ee72bb1c7e3a629d67e19623a4ae (diff)
downloadlua-cjson-41eee7406b0f048392168515b09e7d8bdd000624.tar.gz
lua-cjson-41eee7406b0f048392168515b09e7d8bdd000624.tar.bz2
lua-cjson-41eee7406b0f048392168515b09e7d8bdd000624.zip
Add updated netlib dtoa.c from https://netlib.sandia.gov/fp/dtoa.c
Co-authored-by: Jesper Lundgren <jesperlundgren@exosite.com>
Diffstat (limited to 'fpconv.h')
-rw-r--r--fpconv.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/fpconv.h b/fpconv.h
index 59e0867..5d9d95e 100644
--- a/fpconv.h
+++ b/fpconv.h
@@ -7,10 +7,20 @@
7# define FPCONV_G_FMT_BUFSIZE 32 7# define FPCONV_G_FMT_BUFSIZE 32
8 8
9#ifdef USE_INTERNAL_FPCONV 9#ifdef USE_INTERNAL_FPCONV
10static inline void fpconv_init(void) 10#ifdef MULTIPLE_THREADS
11#include "dtoa_config.h"
12#include <unistd.h>
13static inline void fpconv_init()
14{
15 // Add one to try and avoid core id multiplier alignment
16 set_max_dtoa_threads((sysconf(_SC_NPROCESSORS_CONF) + 1) * 3);
17}
18#else
19static inline void fpconv_init()
11{ 20{
12 /* Do nothing - not required */ 21 /* Do nothing - not required */
13} 22}
23#endif
14#else 24#else
15extern void fpconv_init(void); 25extern void fpconv_init(void);
16#endif 26#endif