Skip to content

Commit 7d5ca24

Browse files
committed
ref(upgrade): fetch chained patches in parallel and fix offtin -0 edge case
Split chain resolution into two phases: serial metadata discovery (lightweight manifest/release JSON) then parallel patch download via Promise.all(). Also fix offtin() returning -0 when magnitude is 0 with sign bit set.
1 parent a8414ac commit 7d5ca24

File tree

2 files changed

+221
-92
lines changed

2 files changed

+221
-92
lines changed

src/lib/bspatch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ export function offtin(buf: Uint8Array, offset: number): number {
6161
// getUint32 already returns unsigned, so hi is in [0, 2^32).
6262
const magnitude = (hi % 0x80_00_00_00) * 0x1_00_00_00_00 + lo;
6363

64-
// Sign in bit 7 of byte 7 (bit 31 of high word)
65-
if (hi >= 0x80_00_00_00) {
64+
// Sign in bit 7 of byte 7 (bit 31 of high word).
65+
// Guard magnitude === 0 to avoid returning -0.
66+
if (magnitude !== 0 && hi >= 0x80_00_00_00) {
6667
return -magnitude;
6768
}
6869
return magnitude;

0 commit comments

Comments
 (0)