Re: [PATCH 03/22] tools lib traceevent: Addtraceevent_host_bigendian function

From: Namhyung Kim
Date: Fri Nov 22 2013 - 09:23:05 EST


2013-11-21 (ë), 12:01 +0100, Jiri Olsa:
> Adding traceevent_host_bigendian function to get host
> endianity. It's used in following patches.

[SNIP]
> +static inline int traceevent_host_bigendian(void)
> +{
> + unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 };
> + unsigned int *ptr;
> +
> + ptr = (unsigned int *)str;
> + return *ptr == 0x01020304;

Is it safe for every architecture supported - especially ones that
require stricter alignment? I know many architectures/compilers align
stack but not sure doing this is safe for all architecture.

Thanks,
Namhyung


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/