The check `src > dst' in the form `&c->out[-back] > c->out' invokes
pointer overflow, which is undefined behavior in C.
Remove the check. Also replace `&c->out[-back] < c->out_start' with
a safe form `c->out - c->out_start < back' to avoid overflow.
CC: libav-stable@libav.org
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
The mingw win32 atomics appear to be faulty, so they should not be used
if the gcc ones are available.
Signed-off-by: Martin Storsjö <martin@martin.st>
On the current code, armcc will fail with:
"libavutil/atomic_gcc.h", line 52: Error: #2771: first argument must be
a pointer to integer or enumeration type
Not all gcc configurations have an implementation of all the atomic
operations, and some gcc configurations have some atomic builtins
implemented but not all.
Thus check for the most essential function, whose presence should
indicate that all others are present as well, since it can be used
to implement all the other ones.
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes them pass standalone compilation tests. Previously,
they included atomic.h which included themselves again, leading to
double definitions.
Signed-off-by: Martin Storsjö <martin@martin.st>
These could be used for reference counting, or for keeping track of
decoding progress in references in multithreaded decoders.
Support is provided by gcc/msvc/suncc intrinsics, with a fallback using
pthread mutexes.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
The "CentaurHauls family 6 model 9 stepping 8" family of CPUs
(flags: fpu vme de pse tsc msr cx8 sep mtrr pge mov pat mmx fxsr sse
up rng rng_en ace ace_en) SIGILLs on long nop codes.
Signed-off-by: Martin Storsjö <martin@martin.st>
On recent android versions, /proc/self/auxw is unreadable
(unless the process is running running under the shell uid or
in debuggable mode, which makes it hard to notice). See
http://b.android.com/43055 and
https://android-review.googlesource.com/51271 for more information
about the issue.
This makes sure e.g. neon optimizations are enabled at runtime in
android apps even when built in release mode, if configured to
use the runtime detection.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes sure that the restrict keyword is mapped to whatever
keyword the compiler prefers/supports. This fixes building on MSVC
(and possibly on GCC 2.x as well).
Signed-off-by: Martin Storsjö <martin@martin.st>