Skip to content

Commit 1342c68

Browse files
committed
refactor: set_fp_exceptions: Use a new macro raise_fp_exceptions(flags) and refine coding style for clearity
1 parent 34601fc commit 1342c68

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

riscv/decode_macros.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,12 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
211211
} \
212212
} while (0);
213213

214-
#define set_fp_exceptions ({ if (softfloat_exceptionFlags) { \
215-
STATE.fflags->write(STATE.fflags->read() | softfloat_exceptionFlags); \
216-
} \
217-
softfloat_exceptionFlags = 0; })
214+
#define raise_fp_exceptions(flags) do { if (flags) STATE.fflags->write(STATE.fflags->read() | (flags)); } while (0);
215+
#define set_fp_exceptions \
216+
do { \
217+
raise_fp_exceptions(softfloat_exceptionFlags); \
218+
softfloat_exceptionFlags = 0; \
219+
} while (0);
218220

219221
#define sext32(x) ((sreg_t)(int32_t)(x))
220222
#define zext32(x) ((reg_t)(uint32_t)(x))

0 commit comments

Comments
 (0)