BYTE_ORDER

Jouni Malinen j
Sat Jun 30 06:04:38 PDT 2012


On Mon, Jun 18, 2012 at 11:40:55AM +0200, Per Ekman wrote:
> Is endian.h guaranteed to define BYTE_ORDER (or even exist)?

Probably not.

> The reason I ask is that when porting to a new environment it's not
> obvious that endian.h is a requirement (since it is conditionally
> included in common.h). Just looking at common.h makes it look like you
> just define __BYTE_ORDER and be on your way but grepping the code makes
> me think that I should define BYTE_ORDER, _BYTE_ORDER and __BYTE_ORDER,
> which feels somewhat ad-hoc (and I guess it is).

endian.h is not a requirement; defining some macros to indicate the byte
order is.

> WORDS_BIGENDIAN sounds much nicer to me.

> From: Per Ekman <pek at boblet.(none)>
> Date: Mon, 18 Jun 2012 11:26:38 +0200
> Subject: [PATCH] Replace references to _*BYTE_ORDER with WORDS_BIGENDIAN

Could you please read the CONTRIBUTIONS file in the top directory and
send the patch with the Signed-hostap: tag?

> -#if BYTE_ORDER == LITTLE_ENDIAN
> -	os_memcpy(in, block, sizeof(in));
> -#else
> +#ifdef WORDS_BIGENDIAN

#ifndef would avoid the need to move the actual code and keep the patch
cleaner.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list