diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-06 22:47:23 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-06 22:47:23 -0500 |
commit | c95b10cff38fabf23a763d1889d024f6dabd4955 (patch) | |
tree | dc014fab60c42ef06c08956773e66f6fa0f83de1 /src | |
parent | 11a84a636ce9722053cc3100d5c04e30e9f93df2 (diff) | |
parent | 831bb584a91f5409af5df3c44f1bc8dc354ff0d8 (diff) |
Merge pull request #2103 from juj/opt_cmp1.10.2
Add optimized versions of musl libc string and memory comparison functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/library.js | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/library.js b/src/library.js index 3a5f6480..4f57c324 100644 --- a/src/library.js +++ b/src/library.js @@ -3761,79 +3761,6 @@ LibraryManager.library = { return pdest; }, - strcmp__deps: ['strncmp'], - strcmp: function(px, py) { - return _strncmp(px, py, TOTAL_MEMORY); - }, - // We always assume ASCII locale. - strcoll: 'strcmp', - strcoll_l__deps: ['strcoll'], - strcoll_l: function(px, py) { - return _strcoll(px, py); // no locale support yet - }, - - strcasecmp__asm: true, - strcasecmp__sig: 'iii', - strcasecmp__deps: ['strncasecmp'], - strcasecmp: function(px, py) { - px = px|0; py = py|0; - return _strncasecmp(px, py, -1)|0; - }, - - strncmp: function(px, py, n) { - var i = 0; - while (i < n) { - var x = {{{ makeGetValue('px', 'i', 'i8', 0, 1) }}}; - var y = {{{ makeGetValue('py', 'i', 'i8', 0, 1) }}}; - if (x == y && x == 0) return 0; - if (x == 0) return -1; - if (y == 0) return 1; - if (x == y) { - i ++; - continue; - } else { - return x > y ? 1 : -1; - } - } - return 0; - }, - - strncasecmp__asm: true, - strncasecmp__sig: 'iiii', - strncasecmp__deps: ['tolower'], - strncasecmp: function(px, py, n) { - px = px|0; py = py|0; n = n|0; - var i = 0, x = 0, y = 0; - while ((i>>>0) < (n>>>0)) { - x = _tolower({{{ makeGetValueAsm('px', 'i', 'i8', 0, 1) }}})|0; - y = _tolower({{{ makeGetValueAsm('py', 'i', 'i8', 0, 1) }}})|0; - if (((x|0) == (y|0)) & ((x|0) == 0)) return 0; - if ((x|0) == 0) return -1; - if ((y|0) == 0) return 1; - if ((x|0) == (y|0)) { - i = (i + 1)|0; - continue; - } else { - return ((x>>>0) > (y>>>0) ? 1 : -1)|0; - } - } - return 0; - }, - - memcmp__asm: true, - memcmp__sig: 'iiii', - memcmp: function(p1, p2, num) { - p1 = p1|0; p2 = p2|0; num = num|0; - var i = 0, v1 = 0, v2 = 0; - while ((i|0) < (num|0)) { - v1 = {{{ makeGetValueAsm('p1', 'i', 'i8', true) }}}; - v2 = {{{ makeGetValueAsm('p2', 'i', 'i8', true) }}}; - if ((v1|0) != (v2|0)) return ((v1|0) > (v2|0) ? 1 : -1)|0; - i = (i+1)|0; - } - return 0; - }, - memchr: function(ptr, chr, num) { chr = unSign(chr); for (var i = 0; i < num; i++) { |