Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/celt/x86
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2022-06-30 23:25:03 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2022-06-30 23:25:03 +0300
commite0ca05b1ec5ef4abbfed5f70623ed3e5ea77dd6b (patch)
treebed3e48aa9b0a734ff9a602f8f186587b6967861 /celt/x86
parent6577534a80c833bd310276f1e2bd3254271bb86d (diff)
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/x86')
-rw-r--r--celt/x86/x86cpu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/celt/x86/x86cpu.c b/celt/x86/x86cpu.c
index d95a9b94..7cfc8db5 100644
--- a/celt/x86/x86cpu.c
+++ b/celt/x86/x86cpu.c
@@ -128,7 +128,7 @@ static void opus_cpu_feature_check(CPU_Feature *cpu_feature)
}
}
-int opus_select_arch(void)
+static int opus_select_arch_impl(void)
{
CPU_Feature cpu_feature;
int arch;
@@ -163,4 +163,13 @@ int opus_select_arch(void)
return arch;
}
+int opus_select_arch(void) {
+ int arch = opus_select_arch_impl();
+#ifdef FUZZING
+ /* Randomly downgrade the architecture. */
+ arch = rand()%(arch+1);
+#endif
+ return arch;
+}
+
#endif