[Skiboot] [PATCH v3 3/7] libpore: Add GLIBC style endianness detection
Stewart Smith
stewart at linux.vnet.ibm.com
Mon Sep 4 10:47:53 AEST 2017
Akshay Adiga <akshay.adiga at linux.vnet.ibm.com> writes:
> diff --git a/libpore/endian.h b/libpore/endian.h
> new file mode 100644
> index 0000000..22a12cf
> --- /dev/null
> +++ b/libpore/endian.h
> @@ -0,0 +1,29 @@
> +/* Copyright 2017 IBM Corp.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> + * implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +/*
> + * Adding GLIBC style endianness check required for p9_stop_api
> + */
> +
> +#include <ccan/endian/endian.h>
> +
> +#ifndef __BYTE_ORDER
> +#define __LITTLE_ENDIAN 1234
> +#define __BIG_ENDIAN 4321
> +
> +/* Support Glibc style endianness check */
> +#define __BYTE_ORDER __BIG_ENDIAN
> +#endif /* __BYTE_ORDER */
Why not submit the above with the appropriate #ifndefs upstream to CCAN?
I'd prefer we deal with it that way rather than having two endian.h
headers in the tree, one of which could give the wrong answer if
included in a unit test.
--
Stewart Smith
OPAL Architect, IBM.
More information about the Skiboot
mailing list