diff options
author | daurnimator <quae@daurnimator.com> | 2018-01-29 22:20:39 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-01-29 22:35:34 +1100 |
commit | ab548fd2c4577d5ca89cc6c5e5e540682fc2d3c2 (patch) | |
tree | 1a771aee799250c208c650cff68a0c9d3e784092 | |
parent | 60822ab541cecf4a4507b9b195e9eb587d56c209 (diff) | |
download | fengari-ab548fd2c4577d5ca89cc6c5e5e540682fc2d3c2.tar.gz fengari-ab548fd2c4577d5ca89cc6c5e5e540682fc2d3c2.tar.bz2 fengari-ab548fd2c4577d5ca89cc6c5e5e540682fc2d3c2.zip |
src/lstrlib.js: Hardcode toupper implementation
-rw-r--r-- | src/lstrlib.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js index e744853..bf12f2e 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -191,10 +191,13 @@ const num2straux = function(x) { const lua_number2strx = function(L, fmt, x) { let buff = num2straux(x); - if (fmt[SIZELENMOD] === 'A'.charCodeAt(0)) { - for (let i = 0; i < buff.length; i++) - buff[i] = String.fromCharCode(buff[i]).toUpperCase().charCodeAt(0); - } else if (fmt[SIZELENMOD] !== 'a'.charCodeAt(0)) + if (fmt[SIZELENMOD] === 65 /* 'A'.charCodeAt(0) */) { + for (let i = 0; i < buff.length; i++) { + let c = buff[i]; + if (c >= 97) /* toupper */ + buff[i] = c & 0xdf; + } + } else if (fmt[SIZELENMOD] !== 97 /* 'a'.charCodeAt(0) */) luaL_error(L, to_luastring("modifiers for format '%%a'/'%%A' not implemented")); return buff; }; |