[libc-commits] [libc] a630b8e - [libc][Obvious] Fix static method declarations for FEnv class on macOS.

Tue Ly via libc-commits libc-commits at lists.llvm.org
Fri Feb 10 22:20:35 PST 2023


Author: Tue Ly
Date: 2023-02-11T01:17:57-05:00
New Revision: a630b8eefb410dae79a44bd1a091addad60b2416

URL: https://github.com/llvm/llvm-project/commit/a630b8eefb410dae79a44bd1a091addad60b2416
DIFF: https://github.com/llvm/llvm-project/commit/a630b8eefb410dae79a44bd1a091addad60b2416.diff

LOG: [libc][Obvious] Fix static method declarations for FEnv class on macOS.

Added: 
    

Modified: 
    libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index ae6ff787aea19..d9acc717a8bb3 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -61,7 +61,7 @@ struct FEnv {
   // __fpcr_flush_to_zero bit in the FPCR register.  This control bit is
   // located in a 
diff erent 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) |
@@ -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) |
@@ -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) |
@@ -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) |
@@ -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) {


        


More information about the libc-commits mailing list