lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c0942db0802091351k6ceb2d28h9f9d5c0fb16e1484@mail.gmail.com>
Date:	Sat, 9 Feb 2008 13:51:00 -0800
From:	"Ray Lee" <ray-lk@...rabbit.org>
To:	"Christoph Hellwig" <hch@...radead.org>
Cc:	jason.wessel@...driver.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/8] kgdb: core API and gdb protocol handler

2008/2/9 Ray Lee <ray-lk@...rabbit.org>:
> On Feb 9, 2008 9:27 AM, Christoph Hellwig <hch@...radead.org> wrote:
> > On Sat, Feb 09, 2008 at 07:35:07AM -0600, jason.wessel@...driver.com wrote:
> > > +#ifdef __BIG_ENDIAN
> > > +             *buf++ = hexchars[(tmp_s >> 12) & 0xf];
> > > +             *buf++ = hexchars[(tmp_s >> 8) & 0xf];
> > > +             *buf++ = hexchars[(tmp_s >> 4) & 0xf];
> > > +             *buf++ = hexchars[tmp_s & 0xf];
> > > +#else
> > > +             *buf++ = hexchars[(tmp_s >> 4) & 0xf];
> > > +             *buf++ = hexchars[tmp_s & 0xf];
> > > +             *buf++ = hexchars[(tmp_s >> 12) & 0xf];
> > > +             *buf++ = hexchars[(tmp_s >> 8) & 0xf];
> > > +#endif
> >
> > This is really ugly, but I don't really know a good way around it
> > either.
>
> void u32_to_hex(u32 val, unsigned char *buf)
> {
>          int i;
>
>          for (i=7; i>=0; i--) {
>                   buf[i] = hexchars[ val & 0x0f ];
>                   val >>= 4;
>          }
> }
>
>          u32_to_hex(tmp_s, buf);
>          buf += 8;
>

Sorry, rewrote what I thought I read, not what was there. I guess
you'd want it more along the lines of

   void u32_to_hex(u32 x, unsigned char *buf)
   {
          int i;
          int val = cpu_to_be32( x );

          for (i=7; ...
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ