All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: sparse errors from string_32.h
Date: Fri, 01 Feb 2008 16:40:15 -0800	[thread overview]
Message-ID: <1201912815.23523.129.camel@brick> (raw)
In-Reply-To: <47A35FBB.5030003@zytor.com>

On Fri, 2008-02-01 at 10:06 -0800, H. Peter Anvin wrote:
> Ingo Molnar wrote:
> > * Harvey Harrison <harvey.harrison@gmail.com> wrote:
> > 
> >>  		case 1:
> >> -			*(unsigned char *)s = pattern;
> >> +			*(unsigned char *)s = pattern & 0xff;
> > 
> > i've applied your fix - but wouldnt it be cleaner to just cast the 
> > pattern variable to unsigned char instead?
> > 
> 
> Even better, since we're talking about fixed bytes, I suggest writing it as:
> 
> 	*(u8 *)s = (u8)pattern;
> 
> Much more compact and the intent is a little bit more obvious.
> 

While I agree that is cleaner, that will still produce sparse warnings
about a cast truncating bits from a constant value.  I think that
explicit & is necessary (unless the cure is worse than the disease).

Harvey


      reply	other threads:[~2008-02-02  0:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01  6:15 [PATCH] x86: sparse errors from string_32.h Harvey Harrison
2008-02-01 10:56 ` Ingo Molnar
2008-02-01 11:07   ` Harvey Harrison
2008-02-01 18:06   ` H. Peter Anvin
2008-02-02  0:40     ` Harvey Harrison [this message]

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=1201912815.23523.129.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.