File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function preprocess(str) {
47
47
// Decode a surrogate pair into an astral codepoint.
48
48
var lead = code - 0xd800 ;
49
49
var trail = str . charCodeAt ( i + 1 ) - 0xdc00 ;
50
- code = Math . pow ( 2 , 20 ) + lead * Math . pow ( 2 , 10 ) + trail ;
50
+ code = Math . pow ( 2 , 16 ) + lead * Math . pow ( 2 , 10 ) + trail ;
51
51
i ++ ;
52
52
}
53
53
codepoints . push ( code ) ;
@@ -58,7 +58,7 @@ function preprocess(str) {
58
58
function stringFromCode ( code ) {
59
59
if ( code <= 0xffff ) return String . fromCharCode ( code ) ;
60
60
// Otherwise, encode astral char as surrogate pair.
61
- code -= Math . pow ( 2 , 20 ) ;
61
+ code -= Math . pow ( 2 , 16 ) ;
62
62
var lead = Math . floor ( code / Math . pow ( 2 , 10 ) ) + 0xd800 ;
63
63
var trail = code % Math . pow ( 2 , 10 ) + 0xdc00 ;
64
64
return String . fromCharCode ( lead ) + String . fromCharCode ( trail ) ;
You can’t perform that action at this time.
0 commit comments