All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Ray Lee <ray-lk@madrabbit.org>
Cc: Ingo Molnar <mingo@elte.hu>, Sam Ravnborg <sam@ravnborg.org>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@zip.com.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Wessel <jason.wessel@windriver.com>
Subject: Re: [git pull] kgdb light, v5
Date: Sun, 10 Feb 2008 18:39:34 +0100	[thread overview]
Message-ID: <47AF36D6.7050507@web.de> (raw)
In-Reply-To: <2c0942db0802100930y5338e545k808d996f9a19bac@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3029 bytes --]

Ray Lee wrote:
> On Feb 10, 2008 8:36 AM, Ingo Molnar <mingo@elte.hu> wrote:
>> +#ifdef CONFIG_64BIT
>> +       } else if ((count == 8) && (((long)mem & 7) == 0)) {
>> +               u64 tmp_ll;
>> +               if (probe_kernel_address(mem, tmp_ll))
>> +                       return ERR_PTR(-EINVAL);
>> +
>> +               mem += 8;
>> +#ifdef __BIG_ENDIAN
>> +               *buf++ = hexchars[(tmp_ll >> 60) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 56) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 52) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 48) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 44) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 40) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 36) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 32) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 28) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 24) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 20) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 16) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 12) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 8) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 4) & 0xf];
>> +               *buf++ = hexchars[tmp_ll & 0xf];
>> +#else
>> +               *buf++ = hexchars[(tmp_ll >> 4) & 0xf];
>> +               *buf++ = hexchars[tmp_ll & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 12) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 8) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 20) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 16) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 28) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 24) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 36) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 32) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 44) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 40) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 52) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 48) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 60) & 0xf];
>> +               *buf++ = hexchars[(tmp_ll >> 56) & 0xf];
>> +#endif
> 
> Am I missing something? (I'm due, so it's not really a rhetorical
> question :-) .) Wouldn't
> 
> unsigned int void u64_to_hex(u64 val, unsigned char *buf)
> {
>          int i;
>          for (i=15; i>=0; i--) {
>                   buf[i] = hexchars[ val & 0x0f ];
>                   val >>= 4;
>          }
>          return 16;
> }
> ...
>          buf += u64_to_hex(cpu_to_be64(tmp_ll), buf);
> 
> be clearer both visually, and code-as-intent? (And equivalent helpers
> for u32, u16 -- though they could all be rolled into one.)

Yes, will come, I just produced some ETOOMANYCHANGESATONCE issue while
improving this. The code goes down by more than 150 lines!

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]

  reply	other threads:[~2008-02-10 17:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10  7:13 [0/6] kgdb light Ingo Molnar
2008-02-10  7:37 ` David Miller
2008-02-10 10:47 ` Sam Ravnborg
2008-02-10 13:25   ` Jan Kiszka
2008-02-10 19:31     ` Sam Ravnborg
2008-02-10 20:23       ` Jan Kiszka
2008-02-10 21:16       ` Ingo Molnar
2008-02-10 21:30         ` Sam Ravnborg
2008-02-10 21:34           ` Ingo Molnar
2008-02-10 16:36   ` [git pull] kgdb light, v5 Ingo Molnar
2008-02-10 17:30     ` Ray Lee
2008-02-10 17:39       ` Jan Kiszka [this message]
2008-02-10 18:59         ` Ray Lee
2008-02-10 18:53       ` Jan Kiszka
2008-02-10 19:34         ` Ingo Molnar
2008-02-10 19:44         ` Linus Torvalds
2008-02-10 20:19           ` Ingo Molnar
2008-02-10 20:22           ` Jan Kiszka
2008-02-10 21:13             ` Ingo Molnar
2008-02-10 20:29           ` Ingo Molnar
2008-02-10 20:41             ` Ingo Molnar
2008-02-10 19:34     ` Sam Ravnborg

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=47AF36D6.7050507@web.de \
    --to=jan.kiszka@web.de \
    --cc=akpm@zip.com.au \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ray-lk@madrabbit.org \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 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.