- Defining the __BYTE_ORDER__ macro - request for improvements - 1 Update
- Let'me learn. - 3 Updates
- Here is my last post on Islam - 1 Update
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jun 06 10:44PM +0200 On 23-May-17 6:07 PM, Alf P. Steinbach wrote: > compile time. > And I'd like that to not have a heavy 3rd party library dependency, such > as Boost. With the feedback I got on that original posting (thanks!) I've • Changed the macro name from g++'s `__BYTE_ORDER__` to `STDLIB_BYTE_ORDER`. • Removed silly powerpc platform checking, for where would it end? Is this reasonable then? ----------------------------------------------------------------------------- #pragma once // Source encoding: utf-8 ∩ // #include <stdlib/workarounds/__BYTE_ORDER__.hpp> // // Copyright © 2017 Alf P. Steinbach, distributed under Boost license 1.0. #ifdef __BYTE_ORDER__ # define STDLIB_BYTE_ORDER __BYTE_ORDER__ # # if !( defined( __ORDER_LITTLE_ENDIAN__ ) && \ defined( __ORDER_BIG_ENDIAN__) && \ defined( __ORDER_PDP_ENDIAN__ ) ) # error __BYTE_ORDER__ is defined but one or more value macros are missing. # endif # # define STDLIB_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ // 1234 # define STDLIB_BIG_ENDIAN __ORDER_BIG_ENDIAN__ // 4321 # define STDLIB_MIXED_ENDIAN __ORDER_PDP_ENDIAN__ // 3412 #else # // The values used by the g++ compiler: # define STDLIB_LITTLE_ENDIAN 1234 # define STDLIB_BIG_ENDIAN 4321 # define STDLIB_MIXED_ENDIAN 3412 # # if defined( _WIN32 ) # define STDLIB_BYTE_ORDER STDLIB_LITTLE_ENDIAN # elif defined( __BIG_ENDIAN__ ) || defined( __BIG_ENDIAN ) || defined( _BIG_ENDIAN ) # define STDLIB_BYTE_ORDER STDLIB_BIG_ENDIAN # else # error Please define STDLIB_BYTE_ORDER, e.g. as STDLIB_LITTLE_ENDIAN. # endif
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment