Index: compiled/String.h |
=================================================================== |
--- a/compiled/String.h |
+++ b/compiled/String.h |
@@ -21,16 +21,23 @@ |
#include <cstddef> |
#include <cstring> |
#include <type_traits> |
#include <emscripten.h> |
#include "debug.h" |
+extern "C" |
+{ |
+ // It seems that calling JS is the easiest solution for lowercasing Unicode |
+ // characters. |
+ char16_t CharToLower(char16_t charCode); |
+} |
+ |
inline void String_assert_readonly(bool readOnly); |
class String |
{ |
friend class DependentString; |
friend class OwnedString; |
public: |
@@ -183,21 +190,17 @@ public: |
value_type currChar = mBuf[i]; |
// This should be more efficient with a lookup table but I couldn't measure |
// any performance difference. |
if (currChar >= u'A' && currChar <= u'Z') |
mBuf[i] = currChar + u'a' - u'A'; |
else if (currChar >= 128) |
{ |
- // It seems that calling JS is the easiest solution for lowercasing |
- // Unicode characters. |
- mBuf[i] = EM_ASM_INT({ |
- return String.fromCharCode($0).toLowerCase().charCodeAt(0); |
- }, currChar); |
+ mBuf[i] = CharToLower(currChar); |
} |
} |
} |
}; |
class DependentString : public String |
{ |
public: |