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
08675bb3
Commit
08675bb3
authored
May 10, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mem: Choose alignment at compile time depending on AVX enabledness.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
53789a27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
mem.c
libavutil/mem.c
+6
-4
No files found.
libavutil/mem.c
View file @
08675bb3
...
@@ -57,6 +57,8 @@ void free(void *ptr);
...
@@ -57,6 +57,8 @@ void free(void *ptr);
#endif
/* MALLOC_PREFIX */
#endif
/* MALLOC_PREFIX */
#define ALIGN (HAVE_AVX ? 32 : 16)
/* You can redefine av_malloc and av_free in your project to use your
/* You can redefine av_malloc and av_free in your project to use your
memory allocator. You do not need to suppress this file because the
memory allocator. You do not need to suppress this file because the
linker will do it automatically. */
linker will do it automatically. */
...
@@ -73,17 +75,17 @@ void *av_malloc(size_t size)
...
@@ -73,17 +75,17 @@ void *av_malloc(size_t size)
return
NULL
;
return
NULL
;
#if CONFIG_MEMALIGN_HACK
#if CONFIG_MEMALIGN_HACK
ptr
=
malloc
(
size
+
32
);
ptr
=
malloc
(
size
+
ALIGN
);
if
(
!
ptr
)
if
(
!
ptr
)
return
ptr
;
return
ptr
;
diff
=
((
-
(
long
)
ptr
-
1
)
&
31
)
+
1
;
diff
=
((
-
(
long
)
ptr
-
1
)
&
(
ALIGN
-
1
)
)
+
1
;
ptr
=
(
char
*
)
ptr
+
diff
;
ptr
=
(
char
*
)
ptr
+
diff
;
((
char
*
)
ptr
)[
-
1
]
=
diff
;
((
char
*
)
ptr
)[
-
1
]
=
diff
;
#elif HAVE_POSIX_MEMALIGN
#elif HAVE_POSIX_MEMALIGN
if
(
posix_memalign
(
&
ptr
,
32
,
size
))
if
(
posix_memalign
(
&
ptr
,
ALIGN
,
size
))
ptr
=
NULL
;
ptr
=
NULL
;
#elif HAVE_MEMALIGN
#elif HAVE_MEMALIGN
ptr
=
memalign
(
32
,
size
);
ptr
=
memalign
(
ALIGN
,
size
);
/* Why 64?
/* Why 64?
Indeed, we should align it:
Indeed, we should align it:
on 4 for 386
on 4 for 386
...
...
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