This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 740127fba2118cef0891ca30e192a0ab848e82ac
Author: buxiasen <[email protected]>
AuthorDate: Thu Sep 25 21:33:32 2025 +0800

    include/math32.h: use arch _uint128_t for math32.h compatible
    
    Use the _uint128_t base type from <arch/types.h> instead of the
    compiler-specific __uint128_t, and switch the availability checks to
    __INT128_DEFINED so the software fallback is used whenever the
    architecture does not provide the 128-bit type.
    
    Assisted-By: mimo-v2.6-pro
    Co-authored-by: ouyangxiangzhen <[email protected]>
    Signed-off-by: buxiasen <[email protected]>
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 include/nuttx/lib/math32.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/nuttx/lib/math32.h b/include/nuttx/lib/math32.h
index f82c02b79ff..1b1a03d86b4 100644
--- a/include/nuttx/lib/math32.h
+++ b/include/nuttx/lib/math32.h
@@ -501,8 +501,8 @@ while(0)
 
 static inline_function uint64_t umulh64(uint64_t a, uint64_t b)
 {
-#ifndef __SIZEOF_INT128__
-  /* If the compiler do not support uint128_t */
+#ifndef __INT128_DEFINED
+  /* If the compiler do not support _uint128_t */
 
   uint64_t al = a & UINT32_MAX;
   uint64_t ah = a >> 32;
@@ -520,8 +520,8 @@ static inline_function uint64_t umulh64(uint64_t a, 
uint64_t b)
 #else
   /* Compiles to a single UMULH instruction on x86_64 and AArch64. */
 
-  __uint128_t a128 = a;
-  __uint128_t res128 = a128 * b;
+  _uint128_t a128 = a;
+  _uint128_t res128 = a128 * b;
   return res128 >> 64;
 #endif
 }
@@ -550,7 +550,7 @@ void invdiv_init_param64(uint64_t d, FAR invdiv_param64_t 
*ip)
 
   DEBUGASSERT(d > 1);
 
-#ifndef __SIZEOF_INT128__
+#ifndef __INT128_DEFINED
   /* If the compiler do not support UINT128 */
 
   uint64_t q[2];
@@ -571,7 +571,7 @@ void invdiv_init_param64(uint64_t d, FAR invdiv_param64_t 
*ip)
 
   ip->mult = q[0] + 1;
 #else
-  __uint128_t one128 = 1;
+  _uint128_t one128 = 1;
   ip->mult = (one128 << 64) * t / d + 1;
 #endif
   ip->shift = l - 1;

Reply via email to