From owner-freebsd-bugs Fri Oct 13 3:40: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D026737B66D for ; Fri, 13 Oct 2000 03:40:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA75338; Fri, 13 Oct 2000 03:40:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Fri, 13 Oct 2000 03:40:02 -0700 (PDT) Message-Id: <200010131040.DAA75338@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/21948: RLIM_INFINITY definition is apparently wrong Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/21948; it has been noted by GNATS. From: Bruce Evans To: jau@iki.fi Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/21948: RLIM_INFINITY definition is apparently wrong Date: Fri, 13 Oct 2000 21:33:30 +1100 (EST) On Thu, 12 Oct 2000 jau@iki.fi wrote: > >Description: > RLIM_INFINITY is currently defined as follows... > > #define RLIM_INFINITY ((rlim_t)(((u_quad_t)1 << 63) - 1)) > > This is apparently wrong, because using an unsigned quad length > integer to represent the value hints that the intended bit pattern > to represent infinity is all 64 bits one, 0xFFFFFFFFFFFFFFFF. > The current definition makes the pattern anyhow 0x3FFFFFFFFFFFFFFF, > which does not require an unsigned type at all. Actually, the current definition makes the bit pattern 0x7FFFFFFFFFFFFFFF. This doesn't require an unsigned type, but one more than it does (on most machines), since subtracting one from the value with bit pattern 0x8000000000000000 would overflow on most machines. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message