svn commit: r356725 - head/usr.bin/diff

Baptiste Daroussin bapt at FreeBSD.org
Tue Jan 14 17:10:12 UTC 2020


On Tue, Jan 14, 2020 at 08:44:29AM -0700, Ian Lepore wrote:
> On Tue, 2020-01-14 at 08:22 +0000, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Tue Jan 14 08:22:28 2020
> > New Revision: 356725
> > URL: https://svnweb.freebsd.org/changeset/base/356725
> > 
> > Log:
> >   When system calls indicate an error they return -1, not some
> > arbitrary
> >   value < 0.  errno is only updated in this case.
> >   
> 
> What's the point of these changes, other than almost certainly leading
> to worse code generation?
> 
> In most instruction sets, you can test for a value < 0 without using
> any instructions, you only need to examine the condition flags after
> loading the value.  To compare equal to -1 typically requires at least
> 1 extra instruction, and on risc architectures typically at least two
> extra (load -1 to a register then compare).
> 
our diff has forked from the OpenBSD one. The goal of those patches is to keep
in sync code that is still close to the original OpenBSD one as much as
possible.

Best regards,
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20200114/eb1c816a/attachment.sig>


More information about the svn-src-head mailing list