gnu.cfg: Add support for bswap*() macros.

This commit is contained in:
versat 2019-04-01 14:25:59 +02:00
parent 7832d69edf
commit 5134fefb52
1 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,18 @@
<alloc init="false" buffer-size="malloc">pvalloc</alloc>
<dealloc>free</dealloc>
</memory>
<define name="bswap_16(x)" value="((unsigned short int) ((((x) &gt;&gt; 8) &amp; 0xff) | (((x) &amp; 0xff) &lt;&lt; 8)))"/>
<define name="__bswap_constant_16(x)" value="bswap_16(x)"/>
<define name="__builtin_bswap16(x)" value="bswap_16(x)"/>
<define name="__bswap_16(x)" value="bswap_16(x)"/>
<define name="bswap_32(x)" value="((((x) &amp; 0xff000000) &gt;&gt; 24) | (((x) &amp; 0x00ff0000) &gt;&gt; 8) | (((x) &amp; 0x0000ff00) &lt;&lt; 8) | (((x) &amp; 0x000000ff) &lt;&lt; 24))"/>
<define name="__bswap_constant_32(x)" value="bswap_32(x)"/>
<define name="__builtin_bswap32(x)" value="bswap_32(x)"/>
<define name="__bswap_32(x)" value="bswap_32(x)"/>
<define name="bswap_64(x)" value="((((x) &amp; 0xff00000000000000ull) &gt;&gt; 56) | (((x) &amp; 0x00ff000000000000ull) &gt;&gt; 40) | (((x) &amp; 0x0000ff0000000000ull) &gt;&gt; 24) | (((x) &amp; 0x000000ff00000000ull) &gt;&gt; 8) | (((x) &amp; 0x00000000ff000000ull) &lt;&lt; 8) | (((x) &amp; 0x0000000000ff0000ull) &lt;&lt; 24) | (((x) &amp; 0x000000000000ff00ull) &lt;&lt; 40) | (((x) &amp; 0x00000000000000ffull) &lt;&lt; 56))"/>
<define name="__bswap_constant_64(x)" value="bswap_64(x)"/>
<define name="__builtin_bswap64(x)" value="bswap_64(x)"/>
<define name="__bswap_64(x)" value="bswap_64(x)"/>
<!-- https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html -->
<define name="__builtin_alloca(size)" value="alloca(size)"/>
<!-- void xexit(int status); -->