[PATCH 1/3] Add rtems_filesystem_make_dev_t_from_pointer()

Daniel Gutson daniel.gutson at tallertechnologies.com
Wed Feb 4 16:24:58 UTC 2015


On Wed, Feb 4, 2015 at 1:16 PM, 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) ...
>
> ?
>
> I know that anyway the variable will likely be optimized out.
>

FWIW, gcc without optimization flags produces different code (thouth -O2
produces the same).


>
>
>> +
>> +  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
>



-- 

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150204/c6f0754d/attachment-0002.html>


More information about the devel mailing list