public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Paul Schlie <schlie@comcast.net>
To: Daniel Jacobowitz <drow@false.org>,
	Richard Sandiford <rsandifo@redhat.com>
Cc: <binutils@sources.redhat.com>
Subject: Re: Bignums and .sleb128
Date: Tue, 01 Feb 2005 00:53:00 -0000	[thread overview]
Message-ID: <BE243D1B.8DB0%schlie@comcast.net> (raw)

> Daniel Jacobowitz <drow@false.org> writes:
> >> You said later that:
> >> 
> >> > If we're going to use these semantics, at least the '-' case in
> >> > operand() needs to be fixed.
> >> 
> >> but I wasn't sure what you meant by "these semantics".  Do you mean
> >> treating bignums as signed, or treating them as unsigned?  By my reading,
> >> operand()'s current handling of '-' already assumes they are signed,
> >> just like the sleb128 code does (and did ;).
> > It doesn't work, because sometimes bignums are signed and sometimes
> > they aren't.  Consider -0xffffffffffff; the current code will return 1.
> > If you want to treat the input as unsigned, then you need to add a new
> > word with the sign bit.  Note that with one less leading 'f', it
> > suddenly works.

Strongly suspect that the proper idiom to is to treat all non-explicitly
negative constants as being unsigned values; where the point of confusion
is that with the exception of decimal numbers; binary, octal, and hex
digits directly correspond to N-bit patters which were likely specified
as such with the implicit intent they be preserved, the only remaining
ambiguity is whether the most-significant specified set-bit is intended
to be sign-extended if the value is stored with greater precision than
than the otherwise required as determined by the most-significant non-0
bit position i.e.:

  -0x1 == [1...]1, where [1...] represents the variable precision
  sign-extension of the most significant bit explicitly specified, which
  would otherwise only require a signed-bit-field:1, but would need to
  be sign extended to fill the remaining most-significant bits if stored
  with greater precision as may be required.

Thereby all constant values may be treated uniformly:

  +1 == +0b01 == +0x1 ...

  -1 == -0b01 == -0x1 ...

  +2 == +0b10 == +0x2 ...

  -2 == -0b10 == -0x2 ...


Which seems quite sensible.

  


             reply	other threads:[~2005-02-01  0:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-01  0:53 Paul Schlie [this message]
2005-02-01  1:09 ` Paul Schlie
2005-02-01  5:04   ` Paul Schlie
2005-02-01  3:29 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2005-01-31 19:54 Daniel Jacobowitz
2005-01-31 21:33 ` Richard Sandiford
2005-01-31 21:57   ` Daniel Jacobowitz
2005-01-31 22:18     ` Richard Sandiford
2005-01-31 22:22       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BE243D1B.8DB0%schlie@comcast.net \
    --to=schlie@comcast.net \
    --cc=binutils@sources.redhat.com \
    --cc=drow@false.org \
    --cc=rsandifo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).