[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47AF36D6.7050507@web.de>
Date: Sun, 10 Feb 2008 18:39:34 +0100
From: Jan Kiszka <jan.kiszka@....de>
To: Ray Lee <ray-lk@...rabbit.org>
CC: Ingo Molnar <mingo@...e.hu>, 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
Ray Lee wrote:
> 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.)
Yes, will come, I just produced some ETOOMANYCHANGESATONCE issue while
improving this. The code goes down by more than 150 lines!
Jan
Download attachment "signature.asc" of type "application/pgp-signature" (255 bytes)
Powered by blists - more mailing lists