Minor changes to dtoa.c to make it easier to work with.
- Change memory allocation to thread a context structure through the code rather than using globals (which would require a -lpthread and some locking to become threadsafe). - Remove a few configuration options (the "private memory" space, and K&R style headers). - Prefix exported symbols with jvp_ to prevent libc conflicts. - Add jvp_dtoa.h - Include netlib's g_fmt.c into dtoa.c - Add a few not-strictly-necessary initialisations in order to compile cleanly with gcc -Wall
This commit is contained in:
1 parent
9e544c55dc
commit
66fd702363
2 files changed
+373
-440
No files matched your search
+353
-440
File diff suppressed because it is too large.
Load diff
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
#define Kmax 7
|
||||
|
||||
struct Bigint;
|
||||
struct dtoa_context {
|
||||
struct Bigint *freelist[Kmax+1];
|
||||
struct Bigint *p5s;
|
||||
};
|
||||
|
||||
void jvp_dtoa_context_init(struct dtoa_context* ctx);
|
||||
void jvp_dtoa_context_free(struct dtoa_context* ctx);
|
||||
|
||||
double jvp_strtod(struct dtoa_context* C, const char* s, char** se);
|
||||
|
||||
|
||||
char* jvp_dtoa(struct dtoa_context* C, double dd, int mode, int ndigits, int *decpt, int *sign, char **rve);
|
||||
void jvp_freedtoa(struct dtoa_context* C, char *s);
|
||||
|
||||
#define JVP_DTOA_FMT_MAX_LEN 32
|
||||
char* jvp_dtoa_fmt(struct dtoa_context* C, register char *b, double x);
|
||||
Reference in new issue
Block a user