Skip to content

Commit e3a47ca

Browse files
authored
Merge pull request #1156 from zqb-all/max-macro
[NFC] target/riscv: simplify code with MAX macros
2 parents 9ff272e + b7708c8 commit e3a47ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/target/riscv/riscv-013.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3566,7 +3566,7 @@ read_memory_abstract(struct target *target, target_addr_t address,
35663566
uint8_t *p = buffer;
35673567
int result = ERROR_OK;
35683568
bool updateaddr = true;
3569-
unsigned int width32 = (width < 32) ? 32 : width;
3569+
unsigned int width32 = MAX(width, 32);
35703570
for (uint32_t c = 0; c < count; c++) {
35713571
/* Update the address if it is the first time or aampostincrement is not supported by the target. */
35723572
if (updateaddr) {

src/target/riscv/riscv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4086,7 +4086,7 @@ static int parse_ranges(struct list_head *ranges, const char *tcl_arg, const cha
40864086
return ERROR_COMMAND_SYNTAX_ERROR;
40874087
}
40884088

4089-
high = high > low ? high : low;
4089+
high = MAX(high, low);
40904090

40914091
if (high > max_val) {
40924092
LOG_ERROR("Cannot expose %s register number %u, maximum allowed value is %u.", reg_type, high, max_val);

0 commit comments

Comments
 (0)