Skip to content

Commit db39bcb

Browse files
authored
Revert "Fix computeChatChecksum returning unsigned byte for i8 schema (#1485)" (#1489)
This reverts commit a263bb9.
1 parent 1cb735a commit db39bcb

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/datatypes/checksums.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ function computeChatChecksum (lastSeenMessages) {
1212
checksum = (31 * checksum + sigHash) & 0xffffffff
1313
}
1414
}
15-
// Convert to signed byte (i8: -128..127) to match the chat_command_signed packet schema.
16-
// The previous `& 0xff` produced 0..255 which causes RangeError when value > 127.
17-
const unsigned = checksum & 0xff
18-
const signed = unsigned > 127 ? unsigned - 256 : unsigned
19-
return signed === 0 ? 1 : signed
15+
// Convert to byte
16+
const result = checksum & 0xff
17+
return result === 0 ? 1 : result
2018
}
2119

2220
module.exports = { computeChatChecksum }

0 commit comments

Comments
 (0)