Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
08a0bb75
Commit
08a0bb75
authored
Oct 10, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_byteswap: use "end" pointer instead of buffer size
parent
20c6159c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
pcm_byteswap.c
src/pcm_byteswap.c
+12
-6
No files found.
src/pcm_byteswap.c
View file @
08a0bb75
...
...
@@ -31,13 +31,16 @@
const
int16_t
*
pcm_byteswap_16
(
struct
pcm_buffer
*
buffer
,
const
int16_t
*
src
,
size_t
len
)
{
unsigned
i
;
int16_t
*
buf
=
pcm_buffer_get
(
buffer
,
len
);
assert
(
buf
!=
NULL
);
for
(
i
=
0
;
i
<
len
/
2
;
i
++
)
buf
[
i
]
=
GUINT16_SWAP_LE_BE
(
src
[
i
]);
const
int16_t
*
src_end
=
src
+
len
/
sizeof
(
*
src
);
int16_t
*
dest
=
buf
;
while
(
src
<
src_end
)
{
const
int16_t
x
=
*
src
++
;
*
dest
++
=
GUINT16_SWAP_LE_BE
(
x
);
}
return
buf
;
}
...
...
@@ -45,13 +48,16 @@ const int16_t *pcm_byteswap_16(struct pcm_buffer *buffer,
const
int32_t
*
pcm_byteswap_32
(
struct
pcm_buffer
*
buffer
,
const
int32_t
*
src
,
size_t
len
)
{
unsigned
i
;
int32_t
*
buf
=
pcm_buffer_get
(
buffer
,
len
);
assert
(
buf
!=
NULL
);
for
(
i
=
0
;
i
<
len
/
4
;
i
++
)
buf
[
i
]
=
GUINT32_SWAP_LE_BE
(
src
[
i
]);
const
int32_t
*
src_end
=
src
+
len
/
sizeof
(
*
src
);
int32_t
*
dest
=
buf
;
while
(
src
<
src_end
)
{
const
int32_t
x
=
*
src
++
;
*
dest
++
=
GUINT32_SWAP_LE_BE
(
x
);
}
return
buf
;
}
...
...
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