浏览代码

Fix BSD-specific types on Linux for aarch64 (#329)

The recent addition of aarch64 fenv support uses BSD-specific types
(__uint64_t and __uint32_t) that are not defined on Linux systems,
causing compilation failures on aarch64-linux targets.

This commit replaces BSD-specific types with standard C99 types:
- __uint64_t → uint64_t
- __uint32_t → uint32_t

These standard types are available on all platforms through the
included <stdint.h> header.

Additionally, this fixes the initialization of __fe_dfl_env from
scalar 0 to {0} to match the typedef as a non-scalar type.

Fixes build failures on aarch64-linux-gnu and other non-BSD platforms.
Keno Fischer 5 月之前
父节点
当前提交
9fbeafcd4f
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 1 1
      aarch64/fenv.c
  2. 6 6
      include/openlibm_fenv_aarch64.h

+ 1 - 1
aarch64/fenv.c

@@ -36,7 +36,7 @@
  * Hopefully the system ID byte is immutable, so it's valid to use
  * this as a default environment.
  */
-const fenv_t __fe_dfl_env = 0;
+const fenv_t __fe_dfl_env = {0};
 
 extern inline int feclearexcept(int __excepts);
 extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);

+ 6 - 6
include/openlibm_fenv_aarch64.h

@@ -36,8 +36,8 @@
 #endif
 
 /* The high 32 bits contain fpcr, low 32 contain fpsr. */
-typedef	__uint64_t	fenv_t;
-typedef	__uint64_t	fexcept_t;
+typedef	uint64_t	fenv_t;
+typedef	uint64_t	fexcept_t;
 
 /* Exception flags */
 #define	FE_INVALID	0x00000001
@@ -158,8 +158,8 @@ fesetround(int __round)
 __fenv_static inline int
 fegetenv(fenv_t *__envp)
 {
-	__uint64_t fpcr;
-	__uint64_t fpsr;
+	uint64_t fpcr;
+	uint64_t fpsr;
 
 	__mrs_fpcr(fpcr);
 	__mrs_fpsr(fpsr);
@@ -179,7 +179,7 @@ feholdexcept(fenv_t *__envp)
 	__msr_fpcr(__r);
 
 	__mrs_fpsr(__r);
-	*__envp |= (__uint32_t)__r;
+	*__envp |= (uint32_t)__r;
 	__r &= ~(_ENABLE_MASK);
 	__msr_fpsr(__r);
 	return (0);
@@ -190,7 +190,7 @@ fesetenv(const fenv_t *__envp)
 {
 
 	__msr_fpcr((*__envp) >> 32);
-	__msr_fpsr((fenv_t)(__uint32_t)*__envp);
+	__msr_fpsr((fenv_t)(uint32_t)*__envp);
 	return (0);
 }