mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-09 08:37:58 +08:00
cpukit/score/src/kern_ntptime.c: Negative Shift Value Warning
The code in question was shifting a signed integer. This was caught by the -Wshift-negative-value GCC warning. Closes #5339.
This commit is contained in:
1 parent
948bbec7f6
commit
78e050f603
1 file changed
+10
@@ -116,6 +116,15 @@ typedef int64_t l_fp;
|
||||
#define L_MPY(v, a) ((v) *= (a))
|
||||
#define L_CLR(v) ((v) = 0)
|
||||
#define L_ISNEG(v) ((v) < 0)
|
||||
#ifdef __rtems__
|
||||
#define L_LINT(v, a) \
|
||||
do { \
|
||||
if ((a) < 0) \
|
||||
((v) = -((uint64_t)(-(a)) << 32)); \
|
||||
else \
|
||||
((v) = (uint64_t)(a) << 32); \
|
||||
} while (0)
|
||||
#else
|
||||
#define L_LINT(v, a) \
|
||||
do { \
|
||||
if ((a) < 0) \
|
||||
@@ -123,6 +132,7 @@ typedef int64_t l_fp;
|
||||
else \
|
||||
((v) = (int64_t)(a) << 32); \
|
||||
} while (0)
|
||||
#endif /* __rtems__ */
|
||||
#define L_GINT(v) ((v) < 0 ? -(-(v) >> 32) : (v) >> 32)
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user