File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ function preprocess(str) {
4747 // Decode a surrogate pair into an astral codepoint.
4848 var lead = code - 0xd800 ;
4949 var trail = str . charCodeAt ( i + 1 ) - 0xdc00 ;
50- code = Math . pow ( 2 , 21 ) + lead * Math . pow ( 2 , 10 ) + trail ;
50+ code = Math . pow ( 2 , 20 ) + lead * Math . pow ( 2 , 10 ) + trail ;
51+ i ++ ;
5152 }
5253 codepoints . push ( code ) ;
5354 }
@@ -57,9 +58,9 @@ function preprocess(str) {
5758function stringFromCode ( code ) {
5859 if ( code <= 0xffff ) return String . fromCharCode ( code ) ;
5960 // Otherwise, encode astral char as surrogate pair.
60- code -= Math . pow ( 2 , 21 ) ;
61+ code -= Math . pow ( 2 , 20 ) ;
6162 var lead = Math . floor ( code / Math . pow ( 2 , 10 ) ) + 0xd800 ;
62- var trail = code % Math . pow ( 2 , 10 ) ; + 0xdc00 ;
63+ var trail = code % Math . pow ( 2 , 10 ) + 0xdc00 ;
6364 return String . fromCharCode ( lead ) + String . fromCharCode ( trail ) ;
6465}
6566
You can’t perform that action at this time.
0 commit comments