Merge pull request #1156 from zqb-all/max-macro

[NFC] target/riscv: simplify code with MAX macros
This commit is contained in:
Evgeniy Naydanov 2024-10-30 17:51:35 +03:00 committed by GitHub
commit e3a47cae3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -3566,7 +3566,7 @@ read_memory_abstract(struct target *target, target_addr_t address,
uint8_t *p = buffer;
int result = ERROR_OK;
bool updateaddr = true;
unsigned int width32 = (width < 32) ? 32 : width;
unsigned int width32 = MAX(width, 32);
for (uint32_t c = 0; c < count; c++) {
/* Update the address if it is the first time or aampostincrement is not supported by the target. */
if (updateaddr) {

View File

@ -4086,7 +4086,7 @@ static int parse_ranges(struct list_head *ranges, const char *tcl_arg, const cha
return ERROR_COMMAND_SYNTAX_ERROR;
}
high = high > low ? high : low;
high = MAX(high, low);
if (high > max_val) {
LOG_ERROR("Cannot expose %s register number %u, maximum allowed value is %u.", reg_type, high, max_val);