Skip to content

Commit e07cd25

Browse files
author
Indrek Altpere
committed
Inline the readInt16, according to cachegrind output this reduces the overall cost of this function by ~30%
1 parent 448b152 commit e07cd25

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/FontLib/BinaryStream.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ public function writeUFWord($data) {
210210
}
211211

212212
public function readInt16() {
213-
$v = $this->readUInt16();
213+
$a = unpack("nn", $this->read(2));
214+
$v = $a["n"];
214215

215216
if ($v >= 0x8000) {
216217
$v -= 0x10000;

0 commit comments

Comments
 (0)