public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	linux-arch <linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/8] kernel: add common infrastructure for unaligned access
Date: Thu, 10 Apr 2008 15:37:59 -0700	[thread overview]
Message-ID: <1207867079.22001.60.camel@brick> (raw)
In-Reply-To: <11989.1207866793-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, 2008-04-10 at 23:33 +0100, David Howells wrote:
> Harvey Harrison <harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> > Well, for the u16 case, won't the compiler warn about truncating the
> > return if I return an int when the function returns u16?
> 
> It doesn't for me for:
> 
> 	u16 test(const u8 *p)
> 	{
> 		return (u16) (p[0] | p[1] << 8);
> 	}
> 
> > In the u64 case, I need the cast to ensure it expands to u64 rather than
> > int from the shift.  Agreed in the u32 case, but then it looks different
> > than the u16/u64 case (cargo-cult I know, but nice for consistency).
> 
> Agreed, the u64 cast is necessary, but I was talking about casts generally of:
> 
> 	<TYPE> function(...)
> 	{
> 		return (<TYPE>) (...);
> 	}
> 

OK, I'll see what other comments come in and keep it in mind for the
next iteration.  I'll also move frv over to the generic C code in that
submission as we discussed.

Harvey

WARNING: multiple messages have this Message-ID (diff)
From: Harvey Harrison <harvey.harrison@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH 1/8] kernel: add common infrastructure for unaligned access
Date: Thu, 10 Apr 2008 15:37:59 -0700	[thread overview]
Message-ID: <1207867079.22001.60.camel@brick> (raw)
Message-ID: <20080410223759.GMGnxlQaOL23I7qx3wEPzqclm_6J2x-i8BbMuLqXrRU@z> (raw)
In-Reply-To: <11989.1207866793@redhat.com>

On Thu, 2008-04-10 at 23:33 +0100, David Howells wrote:
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
> 
> > Well, for the u16 case, won't the compiler warn about truncating the
> > return if I return an int when the function returns u16?
> 
> It doesn't for me for:
> 
> 	u16 test(const u8 *p)
> 	{
> 		return (u16) (p[0] | p[1] << 8);
> 	}
> 
> > In the u64 case, I need the cast to ensure it expands to u64 rather than
> > int from the shift.  Agreed in the u32 case, but then it looks different
> > than the u16/u64 case (cargo-cult I know, but nice for consistency).
> 
> Agreed, the u64 cast is necessary, but I was talking about casts generally of:
> 
> 	<TYPE> function(...)
> 	{
> 		return (<TYPE>) (...);
> 	}
> 

OK, I'll see what other comments come in and keep it in mind for the
next iteration.  I'll also move frv over to the generic C code in that
submission as we discussed.

Harvey


  parent reply	other threads:[~2008-04-10 22:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 19:44 [PATCH 1/8] kernel: add common infrastructure for unaligned access Harvey Harrison
2008-04-10 19:44 ` Harvey Harrison
2008-04-10 21:43 ` David Howells
2008-04-10 21:43   ` David Howells
     [not found]   ` <11527.1207863801-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-04-10 21:55     ` Harvey Harrison
2008-04-10 21:55       ` Harvey Harrison
2008-04-10 22:01       ` David Howells
2008-04-10 22:01         ` David Howells
     [not found]         ` <11814.1207864864-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-04-10 22:06           ` Harvey Harrison
2008-04-10 22:06             ` Harvey Harrison
2008-04-10 22:15             ` David Howells
2008-04-10 22:15               ` David Howells
     [not found]               ` <11907.1207865758-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-04-10 22:20                 ` Harvey Harrison
2008-04-10 22:20                   ` Harvey Harrison
2008-04-10 22:33                   ` David Howells
2008-04-10 22:33                     ` David Howells
     [not found]                     ` <11989.1207866793-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-04-10 22:37                       ` Harvey Harrison [this message]
2008-04-10 22:37                         ` Harvey Harrison
2008-04-11  0:06 ` [PATCHv2 " Harvey Harrison
2008-04-11  0:06   ` Harvey Harrison
2008-04-11 18:09   ` Russell King
2008-04-11 18:09     ` Russell King
     [not found]     ` <20080411180928.GA9137-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2008-04-11 19:01       ` Harvey Harrison
2008-04-11 19:01         ` Harvey Harrison

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=1207867079.22001.60.camel@brick \
    --to=harvey.harrison-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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