You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c/cpp lacks standard macros for this, I noticed there was once an issue mentioned this: #514 .However, __BYTE_ORDER__ is not a portable way to do this, for some compilers such as MSVC doesn't have such definition.
CMake provides TestBigEndian snippet(supserseded by CMAKE_<LANG>_BYTE_ORDER since 3.20), supporting c/c++/cuda/objc/objcxx. Providing resembling API greatly empowers languages such as cpp lack the ability of compile-time byte order determination.
Describe the solution you'd like
CMake uses TestEndianess.c.in for this functionality, and we can refer to TestEndianess.c.in to do such test.
I suggest run this test in configuration stage( xmake f ), and provide an variable var.$(byteorder) describing the endianness. To reduce complexity, the value should be either big_endian or little_endian, ignoring other conditions.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm trying to put some byte-order related functionality in my cpp code, it works like(from UE5 source code):
c/cpp lacks standard macros for this, I noticed there was once an issue mentioned this: #514 .However,
__BYTE_ORDER__
is not a portable way to do this, for some compilers such as MSVC doesn't have such definition.CMake provides
TestBigEndian
snippet(supserseded byCMAKE_<LANG>_BYTE_ORDER
since 3.20), supporting c/c++/cuda/objc/objcxx. Providing resembling API greatly empowers languages such as cpp lack the ability of compile-time byte order determination.Describe the solution you'd like
CMake uses TestEndianess.c.in for this functionality, and we can refer to TestEndianess.c.in to do such test.
I suggest run this test in configuration stage(
xmake f
), and provide an variablevar.$(byteorder)
describing the endianness. To reduce complexity, the value should be eitherbig_endian
orlittle_endian
, ignoring other conditions.Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: