Преглед изворни кода

fix warning sign-compare and macro-redefined on Zephyr platform (#4668)

TianlongLiang пре 2 месеци
родитељ
комит
25c5d575a1

+ 3 - 3
core/shared/platform/common/math/math.c

@@ -851,7 +851,7 @@ freebsd_floor(double x)
                     i0 += 1;
                 else {
                     j = i1 + (1 << (52 - j0));
-                    if (j < i1)
+                    if (j < (u_int32_t)i1)
                         i0 += 1; /* got a carry */
                     i1 = j;
                 }
@@ -913,7 +913,7 @@ freebsd_ceil(double x)
                     i0 += 1;
                 else {
                     j = i1 + (1 << (52 - j0));
-                    if (j < i1)
+                    if (j < (u_int32_t)i1)
                         i0 += 1; /* got a carry */
                     i1 = j;
                 }
@@ -1345,7 +1345,7 @@ freebsd_pow(double x, double y)
             k = (iy >> 20) - 0x3ff; /* exponent */
             if (k > 20) {
                 j = ly >> (52 - k);
-                if ((j << (52 - k)) == ly)
+                if (((u_int32_t)(j << (52 - k))) == ly)
                     yisint = 2 - (j & 1);
             }
             else if (ly == 0) {

+ 2 - 0
core/shared/platform/zephyr/platform_internal.h

@@ -290,7 +290,9 @@ typedef struct timespec os_timespec;
 #define CLOCK_REALTIME 1
 #endif
 
+#ifndef CLOCK_MONOTONIC
 #define CLOCK_MONOTONIC 4
+#endif
 
 static inline int
 os_sched_yield(void)