1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Fix parsing of hex addresses.

Parsing `0800` was ok, but parsing `97CE` was not.
The sign was not correctly handled, this uses `>>> 0` to force unsigned
result.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#%3E%3E%3E_(Zero-fill_right_shift)
This commit is contained in:
Hydra 2019-08-07 20:06:38 +02:00
parent a156ebd31e
commit 52e3aa223c

View file

@ -77,7 +77,8 @@ function read_hex_file(data) {
}
break;
case 0x04: // extended linear address record
extended_linear_address = (parseInt(content.substr(0, 2), 16) << 24) | parseInt(content.substr(2, 2), 16) << 16;
// input address is UNSIGNED
extended_linear_address = ((parseInt(content.substr(0, 2), 16) << 24) | parseInt(content.substr(2, 2), 16) << 16) >>> 0;
break;
case 0x05: // start linear address record
result.start_linear_address = parseInt(content, 16)