mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 03:48:03 +02:00
Add support for byteswap macros bswap_16 and bswap_32
This commit is contained in:
parent
5c732badbc
commit
0bf941c9b2
2 changed files with 17 additions and 1 deletions
|
|
@ -745,7 +745,7 @@ CAIROPERF_LIBS=$RT_LIBS
|
|||
|
||||
dnl ===========================================================================
|
||||
dnl Checks for misc headers
|
||||
AC_CHECK_HEADERS([libgen.h])
|
||||
AC_CHECK_HEADERS([libgen.h byteswap.h])
|
||||
|
||||
dnl ===========================================================================
|
||||
dnl check compiler flags
|
||||
|
|
|
|||
|
|
@ -78,6 +78,22 @@
|
|||
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
|
||||
#endif
|
||||
|
||||
#if HAVE_BYTESWAP_H
|
||||
# include <byteswap.h>
|
||||
#endif
|
||||
#ifndef bswap_16
|
||||
# define bswap_16(p) \
|
||||
(((((uint16_t)(p)) & 0x00ff) << 8) | \
|
||||
(((uint16_t)(p)) >> 8));
|
||||
#endif
|
||||
#ifndef bswap_32
|
||||
# define bswap_32(p) \
|
||||
(((((uint32_t)(p)) & 0x000000ff) << 24) | \
|
||||
((((uint32_t)(p)) & 0x0000ff00) << 8) | \
|
||||
((((uint32_t)(p)) & 0x00ff0000) >> 8) | \
|
||||
((((uint32_t)(p))) >> 24));
|
||||
#endif
|
||||
|
||||
|
||||
#if !HAVE_UINT64_T
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue