PATCH: eliminate some endian #ifs

Jakub Jelinek jakub@redhat.com
Thu Jul 6 14:17:00 GMT 2000


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


More information about the Libc-hacker mailing list