aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library.js13
-rw-r--r--src/parseTools.js4
2 files changed, 12 insertions, 5 deletions
diff --git a/src/library.js b/src/library.js
index 6b5ab687..73d006c9 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4674,14 +4674,17 @@ LibraryManager.library = {
}
},
_toupper: 'toupper',
+
+ tolower__asm: true,
+ tolower__sig: 'ii',
tolower: function(chr) {
- if (chr >= 'A'.charCodeAt(0) && chr <= 'Z'.charCodeAt(0)) {
- return chr - 'A'.charCodeAt(0) + 'a'.charCodeAt(0);
- } else {
- return chr;
- }
+ chr = chr|0;
+ if ((chr|0) < {{{ charCode('A') }}}) return chr|0;
+ if ((chr|0) > {{{ charCode('Z') }}}) return chr|0;
+ return (chr - {{{ charCode('A') }}} + {{{ charCode('a') }}})|0;
},
_tolower: 'tolower',
+
// The following functions are defined as macros in glibc.
islower: function(chr) {
return chr >= 'a'.charCodeAt(0) && chr <= 'z'.charCodeAt(0);
diff --git a/src/parseTools.js b/src/parseTools.js
index 6ce146e9..2664baed 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -2319,3 +2319,7 @@ function getImplementationType(varInfo) {
return varInfo.type;
}
+function charCode(char) {
+ return char.charCodeAt(0);
+}
+