Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2001 18:16:32 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        roam@orbitel.bg (Peter Pentchev)
Cc:        ru@FreeBSD.ORG (Ruslan Ermilov), nik@FreeBSD.ORG (Nik Clayton), arch@FreeBSD.ORG
Subject:   Re: [PATCH] syscons ioctl() to grab text mode buffer
Message-ID:  <200105171816.LAA09113@usr05.primenet.com>
In-Reply-To: <20010517151442.B39834@ringworld.oblivion.bg> from "Peter Pentchev" at May 17, 2001 03:14:42 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> > > Wouldn't it be better to check for < 0 here, too?
> > > More compatible in the long run..
> > > 
> > Nope, see RETURN VALUES in ioctl(2) manpage; see POSIX then.
> > All sysctl's return -1 on error, not <0.
> 
> Oh ok, I didn't know that the explicit -1 return value was standardized.

On a practical note, the code generated merely inverts the sense
of the same cmpl at default optimization, and at -O2 ends up being
either:

        testl %eax,%eax
        jge .L3

or:

        cmpl $-1,%eax  
        jne .L3

So the number of instruction cycles is identical.  Off the top of
my head, I can thing of a number of architectures where "<0" would
be more efficient (single bit test), but personally prefer the
"== -1" test, as being more exact.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105171816.LAA09113>