public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH 4/6] x86: slightly simplify offset_in_range()
Date: Thu, 17 Jun 2021 07:46:40 -0700	[thread overview]
Message-ID: <CAMe9rOovcFtkjNir_UVop0hBinNfYy7555WaOtT-zmrGzMGDVA@mail.gmail.com> (raw)
In-Reply-To: <9cdbd052-04d7-4953-abc4-1215f9e489ea@suse.com>

On Mon, Jun 14, 2021 at 3:26 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> Applying a mask with all bits set (or its inverse, with hence all bits
> clear) won't alter the result (or won't trigger the warning). Re-arrange
> the code to eliminate two more of the somewhat odd (2 << width_minus_1)
> constructs.
>
> gas/
> 2021-06-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * config/tc-i386.c (offset_in_range): Bail early when mask would
>         cover all bits anyway.
>
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -2556,10 +2556,10 @@ offset_in_range (offsetT val, int size)
>      {
>      case 1: mask = ((addressT) 1 <<  8) - 1; break;
>      case 2: mask = ((addressT) 1 << 16) - 1; break;
> -    case 4: mask = ((addressT) 2 << 31) - 1; break;
>  #ifdef BFD64
> -    case 8: mask = ((addressT) 2 << 63) - 1; break;
> +    case 4: mask = ((addressT) 1 << 32) - 1; break;
>  #endif
> +    case sizeof (val): return val;
>      default: abort ();
>      }
>
>

OK.

Thanks.

-- 
H.J.

  reply	other threads:[~2021-06-17 14:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 10:23 [PATCH 0/6] x86: further value overflow diagnostic adjustments Jan Beulich
2021-06-14 10:24 ` [PATCH 1/6] x86: off-by-1 in offset_in_range() Jan Beulich
2021-06-17 14:40   ` H.J. Lu
2021-06-18 10:48     ` Jan Beulich
2021-06-14 10:25 ` [PATCH 2/6] x86: make offset_in_range()'s warning contents useful (again) Jan Beulich
2021-06-17 14:40   ` H.J. Lu
2021-06-14 10:25 ` [PATCH 3/6] x86: harmonize disp with imm handling Jan Beulich
2021-06-17 14:46   ` H.J. Lu
2021-06-17 14:57     ` Jan Beulich
2021-06-17 16:00       ` H.J. Lu
2021-06-17 16:05         ` Jan Beulich
2021-06-17 16:12           ` H.J. Lu
2021-06-18  9:03             ` Jan Beulich
2021-06-18 14:12               ` H.J. Lu
2021-06-18 14:52                 ` Jan Beulich
2021-06-18 15:41                   ` H.J. Lu
2021-06-21  6:36                     ` Jan Beulich
2021-06-21 13:26                       ` H.J. Lu
2021-06-21 15:05                         ` Jan Beulich
2021-06-22 13:22                     ` Michael Matz
2021-06-22 14:01                       ` H.J. Lu
2021-06-22 14:32                         ` Jan Beulich
2021-06-22 14:35                         ` Michael Matz
2021-06-14 10:26 ` [PATCH 4/6] x86: slightly simplify offset_in_range() Jan Beulich
2021-06-17 14:46   ` H.J. Lu [this message]
2021-06-14 10:26 ` [PATCH 5/6] x86: simplify .dispNN setting Jan Beulich
2021-06-17 14:47   ` H.J. Lu
2021-06-14 10:26 ` [PATCH 6/6] x86: bring "gas --help" output for --32 etc in sync with reality Jan Beulich
2021-06-17 14:48   ` H.J. Lu
2021-06-14 14:41 ` [PATCH 0/6] x86: further value overflow diagnostic adjustments H.J. Lu

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=CAMe9rOovcFtkjNir_UVop0hBinNfYy7555WaOtT-zmrGzMGDVA@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).