Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
33f72572
Commit
33f72572
authored
May 10, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimization
Originally committed as revision 4212 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
24dea064
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
bswap.h
libavcodec/bswap.h
+18
-8
No files found.
libavcodec/bswap.h
View file @
33f72572
...
...
@@ -19,7 +19,7 @@
#if defined(ARCH_X86) || defined(ARCH_X86_64)
static
always_inline
uint16_t
bswap_16
(
uint16_t
x
)
{
__asm
(
"
xchgb %b0,%h
0"
:
__asm
(
"
rorw $8, %
0"
:
LEGACY_REGS
(
x
)
:
"0"
(
x
));
return
x
;
...
...
@@ -48,12 +48,15 @@ static inline uint64_t bswap_64(uint64_t x)
"0"
(
x
));
return
x
;
#else
register
union
{
__extension__
uint64_t
__ll
;
uint32_t
__l
[
2
];
}
__x
;
asm
(
"xchgl %0,%1"
:
"=r"
(
__x
.
__l
[
0
]),
"=r"
(
__x
.
__l
[
1
])
:
"0"
(
bswap_32
((
uint32_t
)
x
)),
"1"
(
bswap_32
((
uint32_t
)(
x
>>
32
))));
return
__x
.
__ll
;
union
{
uint64_t
ll
;
struct
{
uint32_t
l
,
h
;
}
l
;
}
r
;
r
.
l
.
l
=
bswap_32
(
x
);
r
.
l
.
h
=
bswap_32
(
x
>>
32
);
return
r
.
ll
;
#endif
}
...
...
@@ -92,11 +95,17 @@ static always_inline uint16_t bswap_16(uint16_t x){
}
static
always_inline
uint32_t
bswap_32
(
uint32_t
x
){
return
(
x
>>
24
)
|
((
x
&
0x00ff0000
)
>>
8
)
|
((
x
&
0x0000ff00
)
<<
8
)
|
(
x
<<
24
);
x
=
((
x
<<
8
)
&
0xFF00FF00
)
|
((
x
>>
8
)
&
0x00FF00FF
);
return
(
x
>>
16
)
|
(
x
<<
16
);
}
static
inline
uint64_t
bswap_64
(
uint64_t
x
)
{
#if 0
x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
return (x>>32) | (x<<32);
#else
union
{
uint64_t
ll
;
uint32_t
l
[
2
];
...
...
@@ -105,6 +114,7 @@ static inline uint64_t bswap_64(uint64_t x)
r
.
l
[
0
]
=
bswap_32
(
w
.
l
[
1
]);
r
.
l
[
1
]
=
bswap_32
(
w
.
l
[
0
]);
return
r
.
ll
;
#endif
}
#endif
/* !ARCH_X86 */
...
...
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