lkml.org 
[lkml]   [2008]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [git pull] kgdb light, v5
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

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-02-10 18:43    [W:0.194 / U:1.968 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site