18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef _ASM_IA64_SWAB_H
38c2ecf20Sopenharmony_ci#define _ASM_IA64_SWAB_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * Modified 1998, 1999
78c2ecf20Sopenharmony_ci *	David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci#include <asm/intrinsics.h>
128c2ecf20Sopenharmony_ci#include <linux/compiler.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistatic __inline__ __attribute_const__ __u64 __arch_swab64(__u64 x)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	__u64 result;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	result = ia64_mux1(x, ia64_mux1_rev);
198c2ecf20Sopenharmony_ci	return result;
208c2ecf20Sopenharmony_ci}
218c2ecf20Sopenharmony_ci#define __arch_swab64 __arch_swab64
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic __inline__ __attribute_const__ __u32 __arch_swab32(__u32 x)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	return __arch_swab64(x) >> 32;
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci#define __arch_swab32 __arch_swab32
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic __inline__ __attribute_const__ __u16 __arch_swab16(__u16 x)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci	return __arch_swab64(x) >> 48;
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci#define __arch_swab16 __arch_swab16
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif /* _ASM_IA64_SWAB_H */
36