Skip to content

Commit

Permalink
Fixed a bug when calculating CRC
Browse files Browse the repository at this point in the history
  • Loading branch information
bminer committed May 28, 2013
1 parent 6f5d394 commit 55e17e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exports.parse = function parseIntelHex(data, bufferSize) {
lowAddress + recordType) & 0xFF;
for(var i = 0; i < dataLength; i++)
calcChecksum = (calcChecksum + dataFieldBuf[i]) & 0xFF;
calcChecksum = 0x100 - calcChecksum;
calcChecksum = (0x100 - calcChecksum) & 0xFF;
if(checksum != calcChecksum)
throw new Error("Invalid checksum on line " + lineNum +
": got " + checksum + ", but expected " + calcChecksum);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intel-hex",
"version": "0.1.0",
"version": "0.1.1",
"description": "A JavaScript parser/writer for Intel HEX file format.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 55e17e6

Please sign in to comment.