Skip to content

Commit

Permalink
[libc][Obvious] Fix static method declarations for FEnv class on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
lntue committed Feb 11, 2023
1 parent e9e43e3 commit a630b8e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct FEnv {
// __fpcr_flush_to_zero bit in the FPCR register. This control bit is
// located in a different place from FE_FLUSHTOZERO status bit relative to
// the other exceptions.
LIBC_INLINE uint32_t exception_value_from_status(int status) {
LIBC_INLINE static uint32_t exception_value_from_status(int status) {
return (status & FE_INVALID ? EX_INVALID : 0) |
(status & FE_DIVBYZERO ? EX_DIVBYZERO : 0) |
(status & FE_OVERFLOW ? EX_OVERFLOW : 0) |
Expand All @@ -70,7 +70,7 @@ struct FEnv {
(status & FE_FLUSHTOZERO ? EX_FLUSHTOZERO : 0);
}

LIBC_INLINE uint32_t exception_value_from_control(int control) {
LIBC_INLINE static uint32_t exception_value_from_control(int control) {
return (control & __fpcr_trap_invalid ? EX_INVALID : 0) |
(control & __fpcr_trap_divbyzero ? EX_DIVBYZERO : 0) |
(control & __fpcr_trap_overflow ? EX_OVERFLOW : 0) |
Expand All @@ -79,7 +79,7 @@ struct FEnv {
(control & __fpcr_flush_to_zero ? EX_FLUSHTOZERO : 0);
}

LIBC_INLINE int exception_value_to_status(uint32_t excepts) {
LIBC_INLINE static int exception_value_to_status(uint32_t excepts) {
return (excepts & EX_INVALID ? FE_INVALID : 0) |
(excepts & EX_DIVBYZERO ? FE_DIVBYZERO : 0) |
(excepts & EX_OVERFLOW ? FE_OVERFLOW : 0) |
Expand All @@ -88,7 +88,7 @@ struct FEnv {
(excepts & EX_FLUSHTOZERO ? FE_FLUSHTOZERO : 0);
}

LIBC_INLINE int exception_value_to_control(uint32_t excepts) {
LIBC_INLINE static int exception_value_to_control(uint32_t excepts) {
return (excepts & EX_INVALID ? __fpcr_trap_invalid : 0) |
(excepts & EX_DIVBYZERO ? __fpcr_trap_divbyzero : 0) |
(excepts & EX_OVERFLOW ? __fpcr_trap_overflow : 0) |
Expand All @@ -97,13 +97,17 @@ struct FEnv {
(excepts & EX_FLUSHTOZERO ? __fpcr_flush_to_zero : 0);
}

static uint32_t get_control_word() { return __arm_rsr("fpcr"); }
LIBC_INLINE static uint32_t get_control_word() { return __arm_rsr("fpcr"); }

static void set_control_word(uint32_t fpcr) { __arm_wsr("fpcr", fpcr); }
LIBC_INLINE static void set_control_word(uint32_t fpcr) {
__arm_wsr("fpcr", fpcr);
}

static uint32_t get_status_word() { return __arm_rsr("fpsr"); }
LIBC_INLINE static uint32_t get_status_word() { return __arm_rsr("fpsr"); }

static void set_status_word(uint32_t fpsr) { __arm_wsr("fpsr", fpsr); }
LIBC_INLINE static void set_status_word(uint32_t fpsr) {
__arm_wsr("fpsr", fpsr);
}
};

LIBC_INLINE int enable_except(int excepts) {
Expand Down

0 comments on commit a630b8e

Please sign in to comment.