[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c0942db0802100930y5338e545k808d996f9a19bac@mail.gmail.com>
Date: Sun, 10 Feb 2008 09:30:01 -0800
From: "Ray Lee" <ray-lk@...rabbit.org>
To: "Ingo Molnar" <mingo@...e.hu>
Cc: "Sam Ravnborg" <sam@...nborg.org>, linux-kernel@...r.kernel.org,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
"Andrew Morton" <akpm@....com.au>,
"Thomas Gleixner" <tglx@...utronix.de>,
"Jason Wessel" <jason.wessel@...driver.com>
Subject: Re: [git pull] kgdb light, v5
On Feb 10, 2008 8:36 AM, Ingo Molnar <mingo@...e.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.)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists