diff options
Diffstat (limited to 'src/lj_str.c')
-rw-r--r-- | src/lj_str.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lj_str.c b/src/lj_str.c index 26f91cba..62322b59 100644 --- a/src/lj_str.c +++ b/src/lj_str.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /* -- String interning ---------------------------------------------------- */ | 21 | /* -- String interning ---------------------------------------------------- */ |
22 | 22 | ||
23 | /* Ordered compare of strings. Assumes string data is 4-byte aligned. */ | 23 | /* Ordered compare of strings. Assumes string data is 4-byte aligned. */ |
24 | int32_t lj_str_cmp(GCstr *a, GCstr *b) | 24 | int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b) |
25 | { | 25 | { |
26 | MSize i, n = a->len > b->len ? b->len : a->len; | 26 | MSize i, n = a->len > b->len ? b->len : a->len; |
27 | for (i = 0; i < n; i += 4) { | 27 | for (i = 0; i < n; i += 4) { |
@@ -119,8 +119,14 @@ void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s) | |||
119 | 119 | ||
120 | /* -- Type conversions ---------------------------------------------------- */ | 120 | /* -- Type conversions ---------------------------------------------------- */ |
121 | 121 | ||
122 | /* Convert string object to number. */ | ||
123 | int LJ_FASTCALL lj_str_tonum(GCstr *str, TValue *n) | ||
124 | { | ||
125 | return lj_str_numconv(strdata(str), n); | ||
126 | } | ||
127 | |||
122 | /* Convert string to number. */ | 128 | /* Convert string to number. */ |
123 | int lj_str_numconv(const char *s, TValue *n) | 129 | int LJ_FASTCALL lj_str_numconv(const char *s, TValue *n) |
124 | { | 130 | { |
125 | lua_Number sign = 1; | 131 | lua_Number sign = 1; |
126 | const uint8_t *p = (const uint8_t *)s; | 132 | const uint8_t *p = (const uint8_t *)s; |
@@ -167,7 +173,7 @@ parsedbl: | |||
167 | } | 173 | } |
168 | 174 | ||
169 | /* Convert number to string. */ | 175 | /* Convert number to string. */ |
170 | GCstr *lj_str_fromnum(lua_State *L, const lua_Number *np) | 176 | GCstr * LJ_FASTCALL lj_str_fromnum(lua_State *L, const lua_Number *np) |
171 | { | 177 | { |
172 | char s[LUAI_MAXNUMBER2STR]; | 178 | char s[LUAI_MAXNUMBER2STR]; |
173 | lua_Number n = *np; | 179 | lua_Number n = *np; |
@@ -176,7 +182,7 @@ GCstr *lj_str_fromnum(lua_State *L, const lua_Number *np) | |||
176 | } | 182 | } |
177 | 183 | ||
178 | /* Convert integer to string. */ | 184 | /* Convert integer to string. */ |
179 | GCstr *lj_str_fromint(lua_State *L, int32_t k) | 185 | GCstr * LJ_FASTCALL lj_str_fromint(lua_State *L, int32_t k) |
180 | { | 186 | { |
181 | char s[1+10]; | 187 | char s[1+10]; |
182 | char *p = s+sizeof(s); | 188 | char *p = s+sizeof(s); |