[PATCH] crypt: Fix strict aliasing warnings
Mike Frysinger
vapier@gentoo.org
Tue Jul 19 14:30:00 GMT 2011
On Monday, July 18, 2011 09:59:59 Marek Polacek wrote:
> +static void
> +le64_copy (char *dest, uint64_t x)
> +{
> + for (size_t i = 0; i < 8; ++i)
> + {
> + dest[i] = (uint8_t) x;
> + x >>= 8;
> + }
> +}
isnt this just a memcpy() for LE systems ?
> +static void
> +be64_copy (char *dest, uint64_t x)
> +{
> + for (size_t i = 8; i-- > 0; x >>= 8)
> + dest[i] = (uint8_t) x;
> +}
and this is just memcpy() for BE systems ?
> +static void
> +be64_copy (char *dest, uint64_t x)
> +{
> + for (size_t i = 8; i-- > 0; x >>= 8)
> + dest[i] = (uint8_t) x;
> +}
looks like this belongs in a local header file rather than copying & pasting
the same thing over and over ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110719/44f68bd5/attachment.sig>
More information about the Libc-alpha
mailing list