-/* $OpenBSD: _endian.h,v 1.7 2018/01/07 15:17:42 kettenis Exp $ */
+/* $OpenBSD: _endian.h,v 1.8 2018/01/11 23:13:37 dlg Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
}
#endif
-#define __swap16(x) (__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
-#define __swap32(x) (__builtin_constant_p(x) ? __swap32gen(x) : __swap32md(x))
-#define __swap64(x) (__builtin_constant_p(x) ? __swap64gen(x) : __swap64md(x))
+#define __swap16(x) \
+ (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
+#define __swap32(x) \
+ (__uint32_t)(__builtin_constant_p(x) ? __swap32gen(x) : __swap32md(x))
+#define __swap64(x) \
+ (__uint64_t)(__builtin_constant_p(x) ? __swap64gen(x) : __swap64md(x))
#if _BYTE_ORDER == _LITTLE_ENDIAN