Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] target/riscv: simplify code with MAX macros #1156

Open
wants to merge 1 commit into
base: riscv
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/target/riscv/riscv-013.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/target/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down