We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fcbf883 + 907f0b7 commit caa7d42Copy full SHA for caa7d42
lib/matplotlib/dviread.py
@@ -356,16 +356,10 @@ def _read(self):
356
357
def _arg(self, nbytes, signed=False):
358
"""
359
- Read and return an integer argument *nbytes* long.
+ Read and return a big-endian integer *nbytes* long.
360
Signedness is determined by the *signed* keyword.
361
362
- buf = self.file.read(nbytes)
363
- value = buf[0]
364
- if signed and value >= 0x80:
365
- value = value - 0x100
366
- for b in buf[1:]:
367
- value = 0x100*value + b
368
- return value
+ return int.from_bytes(self.file.read(nbytes), "big", signed=signed)
369
370
@_dispatch(min=0, max=127, state=_dvistate.inpage)
371
def _set_char_immediate(self, char):
0 commit comments