fuzz_util.h 642 B

1234567891011121314151617181920212223242526272829303132
  1. /* This file is part of the dynarmic project.
  2. * Copyright (c) 2018 MerryMage
  3. * SPDX-License-Identifier: 0BSD
  4. */
  5. #pragma once
  6. #include <array>
  7. #include <iosfwd>
  8. #include <mcl/stdint.hpp>
  9. using Vector = std::array<u64, 2>;
  10. std::ostream& operator<<(std::ostream& o, Vector vec);
  11. Vector RandomVector();
  12. u32 RandomFpcr();
  13. struct InstructionGenerator final {
  14. public:
  15. explicit InstructionGenerator(const char* format);
  16. u32 Generate() const;
  17. u32 Bits() const { return bits; }
  18. u32 Mask() const { return mask; }
  19. bool Match(u32 inst) const { return (inst & mask) == bits; }
  20. private:
  21. u32 bits = 0;
  22. u32 mask = 0;
  23. };