diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-04-28 01:36:09 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-04-28 01:36:09 +0200 |
commit | f81f9eefec2b3cd47d634e88059bf0aa9d920dbe (patch) | |
tree | e8e648f6b959d255fa0fc2198d6d3faf3bee1d61 /printf | |
parent | af176bc4470ba593348cdec6e9e5fd725d58bb07 (diff) | |
download | gmp-f81f9eefec2b3cd47d634e88059bf0aa9d920dbe.tar.gz |
Correction to:
* printf/doprnt.c: Add M for mp_limb_t.
Need "ll" for long long on some systems, "L" is not good enough.
Diffstat (limited to 'printf')
-rw-r--r-- | printf/doprnt.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/printf/doprnt.c b/printf/doprnt.c index 2ff552917..9203ab7b5 100644 --- a/printf/doprnt.c +++ b/printf/doprnt.c @@ -177,6 +177,11 @@ __gmp_doprnt (const struct doprnt_funs_t *funs, void *data, use __gmp_allocate_func rather than TMP_ALLOC, to avoid overflowing the stack if a long output string is given. */ alloc_fmt_size = strlen (orig_fmt) + 1; +#if _LONG_LONG_LIMB + /* for a long long limb we change %Mx to %llx, so could need an extra 1 + char for every 3 existing */ + alloc_fmt_size += alloc_fmt_size / 3; +#endif alloc_fmt = __GMP_ALLOCATE_FUNC_TYPE (alloc_fmt_size, char); fmt = alloc_fmt; strcpy (fmt, orig_fmt); @@ -424,13 +429,17 @@ __gmp_doprnt (const struct doprnt_funs_t *funs, void *data, goto next; case 'M': /* mp_limb_t */ - /* mung format string to l or L and let plain printf handle this */ + /* mung format string to l or ll and let plain printf handle it */ #if _LONG_LONG_LIMB + memmove (fmt+1, fmt, strlen (fmt)+1); + fmt[-1] = 'l'; + fmt[0] = 'l'; + fmt++; type = 'L'; #else + fmt[-1] = 'l'; type = 'l'; #endif - fmt[-1] = type; break; case 'n': |