[PATCH 1/3] Add rtems_filesystem_make_dev_t_from_pointer()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 4 18:14:13 UTC 2015


On 02/04/2015 05:36 PM, Daniel Gutson wrote:
> On Wed, Feb 4, 2015 at 1:27 PM, Gedare Bloom<gedare at gwu.edu>  wrote:
>> >
>> >On Wed, Feb 4, 2015 at 11:16 AM, Daniel Gutson
>> ><daniel.gutson at tallertechnologies.com>  wrote:
>>> > >Hi Sebastian,
>>> > >
>>> > >On Wed, Feb 4, 2015 at 10:46 AM, Sebastian Huber
>>> > ><sebastian.huber at embedded-brains.de>  wrote:
>>>> > >>
>>>> > >>---
>>>> > >>  cpukit/libcsupport/include/rtems/libio.h | 10 ++++++++++
>>>> > >>  1 file changed, 10 insertions(+)
>>>> > >>
>>>> > >>diff --git a/cpukit/libcsupport/include/rtems/libio.h
>>>> > >>b/cpukit/libcsupport/include/rtems/libio.h
>>>> > >>index a4607de..998cd30 100644
>>>> > >>--- a/cpukit/libcsupport/include/rtems/libio.h
>>>> > >>+++ b/cpukit/libcsupport/include/rtems/libio.h
>>>> > >>@@ -1442,6 +1442,16 @@ static inline dev_t rtems_filesystem_make_dev_t(
>>>> > >>    return temp.device;
>>>> > >>  }
>>>> > >>
>>>> > >>+static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
>>>> > >>+  const void *pointer
>>>> > >>+)
>>>> > >>+{
>>>> > >>+  uint64_t one = 1;
>>>> > >>+  uint64_t temp = (one << 63) | (((uintptr_t) pointer) >> 1);
>>> > >
>>> > >
>>> > >Sorry the irrelevant detail, but may I ask why not
>>> > >
>>> > >     (((uint64_t)1) << 63) ...
>>> > >
>>> > >?
>>> > >
>> >Or (1UL << 63)
> It could be 1ULL, but AFAIK it is platform-dependent, so I preferred
> the explicit cast.
>

Yes, 1UL is wrong. Nice would be UINT64_C(1), but this is not available 
in all C++ versions. I change it to the cast, but I don't think it 
really matters.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list