swab.h (498495dba268b20e8eadd7fe93c140c68b6cc9d2) swab.h (37744feebc086908fd89760650f458ab19071750)
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_SH_SWAB_H
3#define __ASM_SH_SWAB_H
4
5/*
6 * Copyright (C) 1999 Niibe Yutaka
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 */
9#include <linux/compiler.h>
10#include <linux/types.h>
11#include <asm-generic/swab.h>
12
13static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
14{
15 __asm__(
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_SH_SWAB_H
3#define __ASM_SH_SWAB_H
4
5/*
6 * Copyright (C) 1999 Niibe Yutaka
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 */
9#include <linux/compiler.h>
10#include <linux/types.h>
11#include <asm-generic/swab.h>
12
13static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
14{
15 __asm__(
16#ifdef __SH5__
17 "byterev %1, %0\n\t"
18 "shari %0, 32, %0"
19#else
20 "swap.b %1, %0\n\t"
21 "swap.w %0, %0\n\t"
22 "swap.b %0, %0"
16 "swap.b %1, %0\n\t"
17 "swap.w %0, %0\n\t"
18 "swap.b %0, %0"
23#endif
24 : "=r" (x)
25 : "r" (x));
26
27 return x;
28}
29#define __arch_swab32 __arch_swab32
30
31static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
32{
33 __asm__(
19 : "=r" (x)
20 : "r" (x));
21
22 return x;
23}
24#define __arch_swab32 __arch_swab32
25
26static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
27{
28 __asm__(
34#ifdef __SH5__
35 "byterev %1, %0\n\t"
36 "shari %0, 32, %0"
37#else
38 "swap.b %1, %0"
29 "swap.b %1, %0"
39#endif
40 : "=r" (x)
41 : "r" (x));
42
43 return x;
44}
45#define __arch_swab16 __arch_swab16
46
47static inline __u64 __arch_swab64(__u64 val)

--- 13 unchanged lines hidden ---
30 : "=r" (x)
31 : "r" (x));
32
33 return x;
34}
35#define __arch_swab16 __arch_swab16
36
37static inline __u64 __arch_swab64(__u64 val)

--- 13 unchanged lines hidden ---