diff options
Diffstat (limited to 'externals/dynarmic/tests/fuzz_util.h')
-rw-r--r-- | externals/dynarmic/tests/fuzz_util.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/externals/dynarmic/tests/fuzz_util.h b/externals/dynarmic/tests/fuzz_util.h new file mode 100644 index 0000000000..9530307725 --- /dev/null +++ b/externals/dynarmic/tests/fuzz_util.h @@ -0,0 +1,31 @@ +/* This file is part of the dynarmic project. + * Copyright (c) 2018 MerryMage + * SPDX-License-Identifier: 0BSD + */ + +#pragma once + +#include <array> +#include <iosfwd> + +#include <mcl/stdint.hpp> + +using Vector = std::array<u64, 2>; + +std::ostream& operator<<(std::ostream& o, Vector vec); +Vector RandomVector(); +u32 RandomFpcr(); + +struct InstructionGenerator final { +public: + explicit InstructionGenerator(const char* format); + + u32 Generate() const; + u32 Bits() const { return bits; } + u32 Mask() const { return mask; } + bool Match(u32 inst) const { return (inst & mask) == bits; } + +private: + u32 bits = 0; + u32 mask = 0; +}; |