mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Add endian set for default toolchain (#2808)
When default toolchain is used and architecture not listed in "#if" in jerry-libm-internal.h on little endian around 90 test-suite tests, 4 unittests and 30 jerry-tests fails depending on setup tested. This change checks endians in case no toolchain is found and sets __LITTLE_ENDIAN macro if it is little endian. This way it will be set for any future arhitectures using little endian and architecture that can have both big and little endian not listed in jerry-libm-internal.h check. JerryScript-DCO-1.0-Signed-off-by: Lidija Besker lidija.besker@rt-rk.com
This commit is contained in:
parent
09d8793e30
commit
e944cdaa8b
@ -30,14 +30,22 @@
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
|
||||
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
/* Check if compiler has byte order macro. Some older versions do not.
|
||||
* If byte order is supported and set to little or target is among common
|
||||
* cases checked define __LITTLE_ENDIAN.
|
||||
*/
|
||||
#if (defined (i386) || defined (__i386) || defined (__i386__) || \
|
||||
defined (i486) || defined (__i486) || defined (__i486__) || \
|
||||
defined (intel) || defined (x86) || defined (i86pc) || \
|
||||
defined (__alpha) || defined (__osf__) || \
|
||||
defined (__x86_64__) || defined (__arm__) || defined (__aarch64__) || \
|
||||
defined (__xtensa__))
|
||||
defined (__xtensa__) || defined (__MIPSEL)) || \
|
||||
(defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
#define __LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif /* !__LITTLE_ENDIAN */
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define __HI(x) *(1 + (int *) &x)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user