diff options
author | YenHaoChen <howard25336284@gmail.com> | 2024-07-23 08:42:05 +0800 |
---|---|---|
committer | YenHaoChen <howard25336284@gmail.com> | 2024-07-23 08:42:23 +0800 |
commit | 1342c687f2b0429b3b185c9f11080300ca14529e (patch) | |
tree | 9a8fa3af25e7e672e24794b943094886709b689f | |
parent | 34601fc48851e49f7ecbbd87405b8b7afcc4e59b (diff) | |
download | spike-1342c687f2b0429b3b185c9f11080300ca14529e.zip spike-1342c687f2b0429b3b185c9f11080300ca14529e.tar.gz spike-1342c687f2b0429b3b185c9f11080300ca14529e.tar.bz2 |
refactor: set_fp_exceptions: Use a new macro raise_fp_exceptions(flags) and refine coding style for clearity
-rw-r--r-- | riscv/decode_macros.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/riscv/decode_macros.h b/riscv/decode_macros.h index 675634a..8574f0d 100644 --- a/riscv/decode_macros.h +++ b/riscv/decode_macros.h @@ -211,10 +211,12 @@ static inline bool is_aligned(const unsigned val, const unsigned pos) } \ } while (0); -#define set_fp_exceptions ({ if (softfloat_exceptionFlags) { \ - STATE.fflags->write(STATE.fflags->read() | softfloat_exceptionFlags); \ - } \ - softfloat_exceptionFlags = 0; }) +#define raise_fp_exceptions(flags) do { if (flags) STATE.fflags->write(STATE.fflags->read() | (flags)); } while (0); +#define set_fp_exceptions \ + do { \ + raise_fp_exceptions(softfloat_exceptionFlags); \ + softfloat_exceptionFlags = 0; \ + } while (0); #define sext32(x) ((sreg_t)(int32_t)(x)) #define zext32(x) ((reg_t)(uint32_t)(x)) |