[coreboot] libpayload endian functions -> macros
Jordan Crouse
jordan.crouse at amd.com
Tue Aug 19 19:34:43 CEST 2008
On 19/08/08 19:26 +0200, Stefan Reinauer wrote:
>
> --
> coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
> Tel.: +49 761 7668825 • Fax: +49 761 7664613
> Email: info at coresystems.de • http://www.coresystems.de/
> Registergericht: Amtsgericht Freiburg • HRB 7656
> Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
>
> replace static functions by macros, because otherwise every unused function
> would warn. Bad thing for all -Werror folks out there.
>
> Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
Acked-by: Jordan Crouse <jordan.crouse at amd.com>
> Index: include/arch/endian.h
> ===================================================================
> --- include/arch/endian.h (revision 3519)
> +++ include/arch/endian.h (working copy)
> @@ -30,17 +30,12 @@
> #ifndef _ARCH_ENDIAN_H
> #define _ARCH_ENDIAN_H
>
> -static u32 ntohl(u32 in)
> -{
> - return ((in & 0xFF) << 24) | ((in & 0xFF00) << 8) |
> - ((in & 0xFF0000) >> 8) | ((in & 0xFF000000) >> 24);
> -}
> +#include <arch/types.h>
>
> -static u64 ntohll(u64 in)
> -{
> - u32 h = in >> 32;
> - u32 l = in & 0xFFFFFFFF;
> +#define ntohw(in) ((( (in) & 0xFF) << 8) | (( (in) & 0xFF00) >> 8))
>
> - return (((u64) ntohl(l) << 32) | ((u64) ntohl(h)));
> -}
> +#define ntohl(in) ((( (in) & 0xFF) << 24) | (( (in) & 0xFF00) << 8) | \
> + (( (in) & 0xFF0000) >> 8) | (( (in) & 0xFF000000) >> 24))
> +
> +#define ntohll(in) (((u64) ntohl( (in) & 0xFFFFFFFF) << 32) | ((u64) ntohl( (in) >> 32)))
> #endif
> --
> coreboot mailing list
> coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
More information about the coreboot
mailing list