aboutsummaryrefslogtreecommitdiff
path: root/src/lj_strfmt.h
diff options
context:
space:
mode:
authorMike Pall <mike>2016-02-26 17:59:43 +0100
committerMike Pall <mike>2016-02-26 18:03:08 +0100
commit18f6aa97fd93df8e9964c2d22f20f16e6b71b72b (patch)
treefad1176f6c01dc1aaf36bafa0b73f22b8e1c37e4 /src/lj_strfmt.h
parent339a1fd69611e2fd084127ee11a36e57035639d1 (diff)
downloadluajit-18f6aa97fd93df8e9964c2d22f20f16e6b71b72b.tar.gz
luajit-18f6aa97fd93df8e9964c2d22f20f16e6b71b72b.tar.bz2
luajit-18f6aa97fd93df8e9964c2d22f20f16e6b71b72b.zip
Use internal implementation for converting FP numbers to strings.
Contributed by Peter Cawley.
Diffstat (limited to 'src/lj_strfmt.h')
-rw-r--r--src/lj_strfmt.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_strfmt.h b/src/lj_strfmt.h
index dcfaf2e3..f229f25c 100644
--- a/src/lj_strfmt.h
+++ b/src/lj_strfmt.h
@@ -64,11 +64,12 @@ typedef enum FormatType {
64#define STRFMT_S (STRFMT_STR) 64#define STRFMT_S (STRFMT_STR)
65#define STRFMT_U (STRFMT_UINT) 65#define STRFMT_U (STRFMT_UINT)
66#define STRFMT_X (STRFMT_UINT|STRFMT_T_HEX) 66#define STRFMT_X (STRFMT_UINT|STRFMT_T_HEX)
67#define STRFMT_G14 (STRFMT_G | ((14+1) << STRFMT_SH_PREC))
67 68
68/* Maximum buffer sizes for conversions. */ 69/* Maximum buffer sizes for conversions. */
69#define STRFMT_MAXBUF_XINT (1+22) /* '0' prefix + uint64_t in octal. */ 70#define STRFMT_MAXBUF_XINT (1+22) /* '0' prefix + uint64_t in octal. */
70#define STRFMT_MAXBUF_INT (1+10) /* Sign + int32_t in decimal. */ 71#define STRFMT_MAXBUF_INT (1+10) /* Sign + int32_t in decimal. */
71#define STRFMT_MAXBUF_NUM LUAI_MAXNUMBER2STR 72#define STRFMT_MAXBUF_NUM 32 /* Must correspond with STRFMT_G14. */
72#define STRFMT_MAXBUF_PTR (2+2*sizeof(ptrdiff_t)) /* "0x" + hex ptr. */ 73#define STRFMT_MAXBUF_PTR (2+2*sizeof(ptrdiff_t)) /* "0x" + hex ptr. */
73 74
74/* Format parser. */ 75/* Format parser. */
@@ -83,10 +84,9 @@ static LJ_AINLINE void lj_strfmt_init(FormatState *fs, const char *p, MSize len)
83 84
84/* Raw conversions. */ 85/* Raw conversions. */
85LJ_FUNC char * LJ_FASTCALL lj_strfmt_wint(char *p, int32_t k); 86LJ_FUNC char * LJ_FASTCALL lj_strfmt_wint(char *p, int32_t k);
86LJ_FUNC char * LJ_FASTCALL lj_strfmt_wnum(char *p, cTValue *o);
87LJ_FUNC char * LJ_FASTCALL lj_strfmt_wptr(char *p, const void *v); 87LJ_FUNC char * LJ_FASTCALL lj_strfmt_wptr(char *p, const void *v);
88LJ_FUNC char * LJ_FASTCALL lj_strfmt_wuleb128(char *p, uint32_t v); 88LJ_FUNC char * LJ_FASTCALL lj_strfmt_wuleb128(char *p, uint32_t v);
89LJ_FUNC const char *lj_strfmt_wstrnum(char *buf, cTValue *o, MSize *lenp); 89LJ_FUNC const char *lj_strfmt_wstrnum(lua_State *L, cTValue *o, MSize *lenp);
90 90
91/* Unformatted conversions to buffer. */ 91/* Unformatted conversions to buffer. */
92LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putint(SBuf *sb, int32_t k); 92LJ_FUNC SBuf * LJ_FASTCALL lj_strfmt_putint(SBuf *sb, int32_t k);