[PATCH 1/3] Add rtems_filesystem_make_dev_t_from_pointer()

Daniel Gutson daniel.gutson at tallertechnologies.com
Wed Feb 4 16:36:09 UTC 2015


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.

>
> > I know that anyway the variable will likely be optimized out.
> >
> >>
> >> +
> >> +  return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t)
> >> temp);
> >> +}
> >> +
> >>  static inline rtems_device_major_number rtems_filesystem_dev_major_t(
> >>    dev_t device
> >>  )
> >> --
> >> 1.8.1.4
> >>
> >> _______________________________________________
> >> devel mailing list
> >> devel at rtems.org
> >> http://lists.rtems.org/mailman/listinfo/devel
> >
> >
> >
> >
> > --
> >
> > Daniel F. Gutson
> > Chief Engineering Officer, SPD
> >
> > San Lorenzo 47, 3rd Floor, Office 5
> > Córdoba, Argentina
> >
> > Phone:   +54 351 4217888 / +54 351 4218211
> > Skype:    dgutson
> > LinkedIn: http://ar.linkedin.com/in/danielgutson
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel




-- 

Daniel F. Gutson
Chief Engineering Officer, SPD

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina

Phone:   +54 351 4217888 / +54 351 4218211
Skype:    dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson


More information about the devel mailing list