From owner-freebsd-arch Thu May 17 11: 9:39 2001 Delivered-To: freebsd-arch@freebsd.org Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (Postfix) with ESMTP id B75AA37B422; Thu, 17 May 2001 11:09:36 -0700 (PDT) (envelope-from tlambert@usr05.primenet.com) Received: (from daemon@localhost) by smtp03.primenet.com (8.9.3/8.9.3) id LAA17687; Thu, 17 May 2001 11:09:35 -0700 (MST) Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp03.primenet.com, id smtpdAAAqLaiEI; Thu May 17 11:09:25 2001 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id LAA09113; Thu, 17 May 2001 11:16:32 -0700 (MST) From: Terry Lambert Message-Id: <200105171816.LAA09113@usr05.primenet.com> Subject: Re: [PATCH] syscons ioctl() to grab text mode buffer To: roam@orbitel.bg (Peter Pentchev) Date: Thu, 17 May 2001 18:16:32 +0000 (GMT) Cc: ru@FreeBSD.ORG (Ruslan Ermilov), nik@FreeBSD.ORG (Nik Clayton), arch@FreeBSD.ORG In-Reply-To: <20010517151442.B39834@ringworld.oblivion.bg> from "Peter Pentchev" at May 17, 2001 03:14:42 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > 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