This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: PATCH: eliminate some endian #ifs


On Thu, Jul 06, 2000 at 01:55:16PM -0700, Greg McGary wrote:
> Ulrich Drepper <drepper@redhat.com> writes:
> 
> > > No build-shared & build-static failures or binary differences for i686.
> 
> Same deal.
> 
> I refined this a bit further: __LONG_LONG_SPLIT accepts a single
> 64-bit quantity, breaks it into two 32-bit args, and passes the pieces
> according to __BYTE_ORDER.

This will not correctly if 32bit value (such as off_t on 32bit arch; see
pread/pwrite below e.g.) is passed to __LONG_LONG_SPLIT.
You'll get a
warning: right shift count >= width of type
and undefined result. 
You must either use something like:
#define __LONG_LONG_SPLIT(LL)	\
__LONG_LONG_PAIR (((unsigned long long)(LL)) >> 32, (LL) & 0xffffffff)
or not use __LONG_LONG_SPLIT on 32bit types.

	Jakub

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