[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225047674.10060.10.camel@brick>
Date: Sun, 26 Oct 2008 12:01:14 -0700
From: Harvey Harrison <harvey.harrison@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: David Miller <davem@...emloft.net>, anders@...uras.de,
netdev@...r.kernel.org
Subject: Re: [PATCH] add %pM printf format specifier
On Sun, 2008-10-26 at 09:30 +0100, Johannes Berg wrote:
> static char *ip6_string(char *buf, char *end, be16 *addr, int field_width, int precision, int flags)
> {
> char ip6[8*5];
> char *p = ip6;
> int i;
> u16 tmp;
>
> for (i=0; i<7; i++) {
> tmp = cpu_to_le16(addr[i]);
tmp = be16_to_cpup(addr + i);
> p = pack_hex_byte(p, tmp >> 8);
> p = pack_hex_byte(p, tmp & 0xFF);
> if (!(flags & SPECIAL))
> *p++ = ':';
> }
> tmp = cpu_to_le16(addr[7]);
tmp = be16_to_cpup(addr + 7);
Or maybe just cast addr to char * and avoid the byteswapping altogether.
Just a thought,
Harvey
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists