#ifndef lib_swap_h #define lib_swap_h /* Cesar project {{{ * * Copyright (C) 2007 Spidcom * * <<>> * * }}} */ /** * \file lib/swap.h * \brief generic swap functions * \ingroup lib */ /** swap an unsigned short */ extern u16 swap16(u16 x); /** swap an unsigned long */ extern u32 swap32(u32 x); #if DEFS_BIG_ENDIAN #define ntohs(x) (x) #define ntohl(x) (x) #define htons(x) (x) #define htonl(x) (x) #else #define ntohs(x) (swap16(x)) #define ntohl(x) (swap32(x)) #define htons(x) (swap16(x)) #define htonl(x) (swap32(x)) #endif #endif /* lib_swap_h */