This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Setting long long bitfields
- From: Andreas Schwab <schwab at suse dot de>
- To: Hilfinger at CS dot Berkeley dot EDU
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 01 Nov 2004 03:45:21 +0100
- Subject: Re: [RFA] Setting long long bitfields
- References: <200410312304.i9VN3xLF022057@tully.CS.Berkeley.EDU>
Paul Hilfinger <hilfingr@EECS.Berkeley.EDU> writes:
> > > One possible tweak, several of us have an aversion to "?:", it would be
> > > nice if it wasn't there :-)
> >
> > Like this perhaps:
> >
> > + ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
>
> Andreas,
>
> I had considered exactly that line, but unfortunately ran across the
> following really irritating provision in the C standard:
>
> "If the value of the right operand is negative or is
> *greater than or equal to* the width of the promoted left
> operand, the behavior is undefined."
That cannot happen, because bitsize will never be zero.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."