Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
7a65eaf4
Commit
7a65eaf4
authored
Nov 09, 2007
by
Paul Mundt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sh:
SH-5
byteorder routines.
Signed-off-by:
Paul Mundt
<
lethal@linux-sh.org
>
parent
4690bdc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
include/asm-sh/byteorder.h
include/asm-sh/byteorder.h
+30
-15
No files found.
include/asm-sh/byteorder.h
View file @
7a65eaf4
...
...
@@ -3,40 +3,55 @@
/*
* Copyright (C) 1999 Niibe Yutaka
* Copyright (C) 2000, 2001 Paolo Alberelli
*/
#include <asm/types.h>
#include <linux/compiler.h>
#include <linux/types.h>
static
__inline__
__attribute_const__
__u32
___arch__swab32
(
__u32
x
)
static
inline
__attribute_const__
__u32
___arch__swab32
(
__u32
x
)
{
__asm__
(
"swap.b %0, %0
\n\t
"
"swap.w %0, %0
\n\t
"
"swap.b %0, %0"
__asm__
(
#ifdef CONFIG_SUPERH32
"swap.b %0, %0
\n\t
"
"swap.w %0, %0
\n\t
"
"swap.b %0, %0"
#else
"byterev %0, %0
\n\t
"
"shari %0, 32, %0"
#endif
:
"=r"
(
x
)
:
"0"
(
x
));
return
x
;
}
static
__inline__
__attribute_const__
__u16
___arch__swab16
(
__u16
x
)
static
inline
__attribute_const__
__u16
___arch__swab16
(
__u16
x
)
{
__asm__
(
"swap.b %0, %0"
__asm__
(
#ifdef CONFIG_SUPERH32
"swap.b %0, %0"
#else
"byterev %0, %0
\n\t
"
"shari %0, 32, %0"
#endif
:
"=r"
(
x
)
:
"0"
(
x
));
return
x
;
}
static
inline
__u64
___arch__swab64
(
__u64
val
)
{
union
{
static
inline
__u64
___arch__swab64
(
__u64
val
)
{
union
{
struct
{
__u32
a
,
b
;
}
s
;
__u64
u
;
}
v
,
w
;
v
.
u
=
val
;
w
.
s
.
b
=
___arch__swab32
(
v
.
s
.
a
);
w
.
s
.
a
=
___arch__swab32
(
v
.
s
.
b
);
return
w
.
u
;
}
w
.
s
.
b
=
___arch__swab32
(
v
.
s
.
a
);
w
.
s
.
a
=
___arch__swab32
(
v
.
s
.
b
);
return
w
.
u
;
}
#define __arch__swab64(x) ___arch__swab64(x)
#define __arch__swab32(x) ___arch__swab32(x)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment