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


The following commit(s) were added to refs/heads/master by this push:
     new 1b6cb817c35 include/strings.h: Fix MISRA C-2012 Rule 10.4
1b6cb817c35 is described below

commit 1b6cb817c35ca97968e82830451ccd77a24fd95a
Author: yukangzhi <[email protected]>
AuthorDate: Thu Nov 6 11:31:41 2025 +0800

    include/strings.h: Fix MISRA C-2012 Rule 10.4
    
    misra_c_2012_rule_10_4_violation: The basic type of the left operand
    8U (signed type) is different from that of the right operand
    sizeof (int) (unsigned type).
    
    misra_c_2012_rule_10_4_violation: The basic type of the left operand
    32U (unsigned type) is different from that of the right operand
    __builtin_clz(dict_expendsize / 12U) (signed type).
    
    Signed-off-by: yukangzhi <[email protected]>
---
 include/strings.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/strings.h b/include/strings.h
index 660b071df53..4e294180db8 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -106,19 +106,19 @@ int ffsll(long long j);
 int fls(int j);
 
 #ifdef CONFIG_HAVE_BUILTIN_CLZ
-#  define fls(j)  ((8 * sizeof(int)) - __builtin_clz(j))
+#  define fls(j)  ((8u * sizeof(int)) - (size_t)__builtin_clz(j))
 #endif
 
 int flsl(long j);
 
 #ifdef CONFIG_HAVE_BUILTIN_CLZ
-#  define flsl(j)  ((8 * sizeof(long)) - __builtin_clzl(j))
+#  define flsl(j)  ((8u * sizeof(long)) - (size_t)__builtin_clzl(j))
 #endif
 
 int flsll(long long j);
 
 #ifdef CONFIG_HAVE_BUILTIN_CLZ
-#  define flsll(j)  ((8 * sizeof(long long)) - __builtin_clzll(j))
+#  define flsll(j)  ((8u * sizeof(long long)) - (size_t)__builtin_clzll(j))
 #endif
 
 unsigned int popcount(unsigned int j);

Reply via email to