summaryrefslogtreecommitdiff
path: root/celt/arm
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2022-06-30 16:25:03 -0400
committerJean-Marc Valin <jmvalin@amazon.com>2022-06-30 16:25:03 -0400
commite0ca05b1ec5ef4abbfed5f70623ed3e5ea77dd6b (patch)
treebed3e48aa9b0a734ff9a602f8f186587b6967861 /celt/arm
parent6577534a80c833bd310276f1e2bd3254271bb86d (diff)
downloadopus-e0ca05b1ec5ef4abbfed5f70623ed3e5ea77dd6b.tar.gz
Adds fuzzing to CPU detection
Makes ti possible to randomize (with --enable-fuzzing) the CPU flags so we can better test all the intrinsics implementations.
Diffstat (limited to 'celt/arm')
-rw-r--r--celt/arm/armcpu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/celt/arm/armcpu.c b/celt/arm/armcpu.c
index cce3ae3a..c7d16e6d 100644
--- a/celt/arm/armcpu.c
+++ b/celt/arm/armcpu.c
@@ -156,7 +156,7 @@ opus_uint32 opus_cpu_capabilities(void)
"your platform. Reconfigure with --disable-rtcd (or send patches)."
#endif
-int opus_select_arch(void)
+static int opus_select_arch_impl(void)
{
opus_uint32 flags = opus_cpu_capabilities();
int arch = 0;
@@ -184,4 +184,11 @@ int opus_select_arch(void)
return arch;
}
+int opus_select_arch(void) {
+ int arch = opus_select_arch_impl();
+#ifdef FUZZING
+ arch = rand()%(arch+1);
+#endif
+ return arch;
+}
#endif