9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bitfields
@ 2007-06-06 11:57 erik quanstrom
  2007-06-06 23:34 ` don bailey
  0 siblings, 1 reply; 2+ messages in thread
From: erik quanstrom @ 2007-06-06 11:57 UTC (permalink / raw)
  To: 9fans

actually, if bit fields operate on 2s complement i think
that's the correct answer.

if you have a n-bit integer ~0 (all ones) is -1.  so if you
have a one-bit signed integer, the possiblities are 0b and
1b which should be 0 and -1.

- erik

On Wed Jun  6 03:06:00 EDT 2007, bruce.ellis@gmail.com wrote:
> easy.  ken had (has) no respect for bitfields.
> he is a wise man.
>
> brucee
>
> On 6/6/07, Kris Maglione <bsdaemon@comcast.net> wrote:
> > On Wed, Jun 06, 2007 at 12:30:55AM -0400, Kris Maglione wrote:
> > > !8c test.c && 8l test.8
> > > !
> > > !./8.out
> > > foo.x: -1
> > > !
> >
> > Also:
> >
> > !8c -wF test.c && 8l test.8
> > warning: test.c:11 format mismatch d LONG 0:1, arg 2
> > !
> >
> > I'm surprised that there's not a warning about the overflow.
> >
> > --
> > Kris Maglione
> >
> > For every human problem, there is a neat, plain solution --
> > and it is always wrong.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] bitfields
  2007-06-06 11:57 [9fans] bitfields erik quanstrom
@ 2007-06-06 23:34 ` don bailey
  0 siblings, 0 replies; 2+ messages in thread
From: don bailey @ 2007-06-06 23:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

erik quanstrom wrote:
> actually, if bit fields operate on 2s complement i think
> that's the correct answer.
>
> if you have a n-bit integer ~0 (all ones) is -1.  so if you
> have a one-bit signed integer, the possiblities are 0b and
> 1b which should be 0 and -1.

That's my take on it as long as the type is defined as signed.
Did GNU always enforce bitfields to be unsigned before? What
was the reasoning behind this change?


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGZ0RoyWX0NBMJYAcRAk1kAJsHjzP5/VlPKVfgGKaotVjx/Ema3gCfXcY2
pORPJK00rGWu4oGeBaW1mDU=
=TTAS
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-06 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-06 11:57 [9fans] bitfields erik quanstrom
2007-06-06 23:34 ` don bailey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).