This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Fix p{readv,writev}{64} consolidation implementation



On 15/06/2016 19:38, Mike Frysinger wrote:
> On 15 Jun 2016 18:20, Adhemerval Zanella wrote:
>> --- a/sysdeps/unix/sysv/linux/sysdep.h
>> +++ b/sysdeps/unix/sysv/linux/sysdep.h
>> @@ -47,3 +47,12 @@
>>  #define SYSCALL_LL64(val) \
>>    __LONG_LONG_PAIR ((long) ((val) >> 32), (long) ((val) & 0xffffffff))
>>  #endif
>> +
>> +/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}.  */
>> +#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
>> +# define LO_HI_LONG(val) (val)
>> +#else
>> +# define LO_HI_LONG(val) \
>> +  (off_t) (val),                                                          \
>> +  (off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
>> +#endif
> 
> does this really need to be this complicated ?  we're already making an
> assumption about the size for 64-bit & 64-bit/ilp32 ports, and you're
> using an uint64_t cast to start with, and SYSCALL_LL64 assumes 32.
>   (long) (val),
>   (long) (((uint64_t) (val)) >> 32)
> -mike
> 

I think your suggestion should be ok, this snippet I used came from
the previous version in fact.  I will change to just

/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}.  */
#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
# define LO_HI_LONG(val) (val)
#else
# define LO_HI_LONG(val) \
   (long) (val), \
   (long) (((uint64_t) (val)) >> 32)
#endif

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]