pread, pwrite linux implementation does not conform to Single Unix Specification

Ulrich Drepper drepper@redhat.com
Wed Jul 17 12:14:00 GMT 2002


On Wed, 2002-07-17 at 11:52, Andreas Schwab wrote:

> -			   __LONG_LONG_PAIR (0, offset));
> +			   __LONG_LONG_PAIR (-(offset < 0), offset));

Why do you use

  -(offset < 0)

instead of

  offset >> (sizeof (offset) * 8 - 1)

gcc 3.2 (well 3.3) will optimize the former to produce exactly the code
the latter code suggests but earlier versions of the compiler cannot do
this.  They need three instruction.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20020717/55bc739b/attachment.sig>


More information about the Libc-alpha mailing list