LogCabin
|
00001 /* Copyright (c) 2012 Stanford University 00002 * 00003 * Permission to use, copy, modify, and distribute this software for any 00004 * purpose with or without fee is hereby granted, provided that the above 00005 * copyright notice and this permission notice appear in all copies. 00006 * 00007 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES 00008 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00009 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR 00010 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00011 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00012 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00013 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00014 */ 00015 00016 #include <cinttypes> 00017 #include <endian.h> 00018 00019 #ifndef LOGCABIN_CORE_ENDIAN_H 00020 #define LOGCABIN_CORE_ENDIAN_H 00021 00022 // RHEL6 is missing this cast, which affects htobe16 and 00023 // be16toh. 00024 #ifdef __bswap_constant_16 00025 #undef __bswap_constant_16 00026 #define __bswap_constant_16(x) \ 00027 (uint16_t((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) 00028 #endif 00029 00030 #endif /* LOGCABIN_CORE_ENDIAN_H */