Skip to content

Commit

Permalink
modify: support read 8 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
ykisii committed Apr 28, 2023
1 parent 2975aa6 commit 47dbbc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions binary_to_json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export class BinaryToJSON {

private readBytes(br: BinaryReader, length: number): number {
const surplusLength = length >= 4 ? length - 4 : 0;
const bytes = br.readBytes(length);
let shift = 0x00;
const bytes = br.readBytes(length - surplusLength);
let val = this.convolutionBytes(bytes);
if (surplusLength > 0) {
for (let i = 0; i < surplusLength*2; i++) {
val *= 16;
}
val += this.convolutionBytes(br.readBytes(surplusLength));
}
return val;
}

Expand Down

0 comments on commit 47dbbc5

Please sign in to comment.