mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-27 22:45:27 +00:00
Properly handle negative numbers
Now -3.141592 and -32768 are valid numbers that's stored correctly in memory
This commit is contained in:
@@ -428,9 +428,9 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p,
|
||||
}
|
||||
}
|
||||
buf[i - start_offset + bytes_grown] = (write_val >> 0) & 0xFF;
|
||||
if (write_val > 0xFF || ptr)
|
||||
if (labs(write_val) > 0xFF || ptr)
|
||||
buf[i - start_offset + ++bytes_grown] = (write_val >> 8) & 0xFF;
|
||||
if (write_val > 0xFFFF || ptr) {
|
||||
if (labs(write_val) > 0xFFFF || ptr) {
|
||||
buf[i - start_offset + ++bytes_grown] = (write_val >> 16) & 0xFF;
|
||||
buf[i - start_offset + ++bytes_grown] = (write_val >> 24) & 0xFF;
|
||||
}
|
||||
|
Reference in New Issue
Block a user