[PATCH 2/3] score: Silence integer conversion warnings

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 24 09:57:40 UTC 2016


---
 cpukit/score/include/rtems/score/prioritybitmapimpl.h | 3 ++-
 cpukit/score/include/rtems/score/schedulerimpl.h      | 2 +-
 cpukit/score/include/rtems/score/timestamp.h          | 2 +-
 cpukit/score/include/rtems/score/watchdogimpl.h       | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
index 0082720..82c92eb 100644
--- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h
+++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
@@ -61,7 +61,8 @@ RTEMS_INLINE_ROUTINE unsigned int _Bitfield_Find_first_bit(
 #if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
   _CPU_Bitfield_Find_first_bit( value, bit_number );
 #elif defined(__GNUC__)
-  bit_number = __builtin_clz( value ) - __SIZEOF_INT__ * __CHAR_BIT__ + 16;
+  bit_number = (unsigned int) __builtin_clz( value )
+    - __SIZEOF_INT__ * __CHAR_BIT__ + 16;
 #else
   if ( value < 0x100 ) {
     bit_number = _Bitfield_Leading_zeros[ value ] + 8;
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 11347fe..9885adf 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -749,7 +749,7 @@ RTEMS_INLINE_ROUTINE Objects_Id _Scheduler_Build_id( uint32_t scheduler_index )
     OBJECTS_FAKE_OBJECTS_API,
     OBJECTS_FAKE_OBJECTS_SCHEDULERS,
     _Objects_Local_node,
-    scheduler_index + 1
+    (uint16_t) ( scheduler_index + 1 )
   );
 }
 
diff --git a/cpukit/score/include/rtems/score/timestamp.h b/cpukit/score/include/rtems/score/timestamp.h
index 9d25943..8b1a738 100644
--- a/cpukit/score/include/rtems/score/timestamp.h
+++ b/cpukit/score/include/rtems/score/timestamp.h
@@ -282,7 +282,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Timestamp_Get_nanoseconds(
 
   bintime2timespec( _time, &_ts );
 
-  return _ts.tv_nsec;
+  return (uint32_t) _ts.tv_nsec;
 }
 
 /**
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h
index b76a51a..c5f8d20 100644
--- a/cpukit/score/include/rtems/score/watchdogimpl.h
+++ b/cpukit/score/include/rtems/score/watchdogimpl.h
@@ -318,7 +318,7 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Ticks_from_timespec(
   _Assert( ts->tv_nsec < 1000000000 );
 
   ticks <<= WATCHDOG_BITS_FOR_1E9_NANOSECONDS;
-  ticks |= ts->tv_nsec;
+  ticks |= (uint32_t) ts->tv_nsec;
 
   return ticks;
 }
-- 
1.8.4.5




More information about the devel mailing list