/**
 * Author......: See docs/credits.txt
 * License.....: MIT
 */

#ifndef HC_BITOPS_H
#define HC_BITOPS_H

u32 rotl32  (const u32 a, const int n);
u32 rotr32  (const u32 a, const int n);
u64 rotl64  (const u64 a, const int n);
u64 rotr64  (const u64 a, const int n);

u16 byte_swap_16  (const u16 n);
u32 byte_swap_32  (const u32 n);
u64 byte_swap_64  (const u64 n);

// Conditional byte swap macros for endianness conversion
// These convert between native byte order and big-endian byte order
#if HC_BIG_ENDIAN
#define byte_swap_32_to_be(n) (n)
#define byte_swap_64_to_be(n) (n)
#else
#define byte_swap_32_to_be(n) byte_swap_32(n)
#define byte_swap_64_to_be(n) byte_swap_64(n)
#endif

#endif // HC_BITOPS_H
