Optimize LineTable#find implementation
This commit is contained in:
parent
c9cb8a7deb
commit
65e2c17627
1 changed files with 2 additions and 2 deletions
|
|
@ -62,8 +62,8 @@ export function createLineTable(source: string): LineTable {
|
|||
let line = 0
|
||||
let count = table.length
|
||||
while (count > 0) {
|
||||
// `| 0` causes integer division
|
||||
let mid = (count / 2) | 0
|
||||
// `| 0` forces integer bytecode generation
|
||||
let mid = (count | 0) >> 1
|
||||
let i = line + mid
|
||||
if (table[i] <= offset) {
|
||||
line = i + 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue