mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-19 07:31:15 +00:00
Switch back to the natural type.
This commit is contained in:
parent
f2fdfe86ec
commit
83c8f9996e
@ -15,7 +15,7 @@
|
|||||||
using namespace InstructionSet::x86;
|
using namespace InstructionSet::x86;
|
||||||
|
|
||||||
template <Model model>
|
template <Model model>
|
||||||
std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(const uint8_t *source, uint32_t length) {
|
std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(const uint8_t *source, std::size_t length) {
|
||||||
// Instruction length limits:
|
// Instruction length limits:
|
||||||
//
|
//
|
||||||
// 8086/80186: none*
|
// 8086/80186: none*
|
||||||
@ -26,7 +26,7 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
|
|||||||
// be back to wherever it started, so it's safe to spit out a NOP and reset parsing
|
// be back to wherever it started, so it's safe to spit out a NOP and reset parsing
|
||||||
// without any loss of context. This reduces the risk of the decoder tricking a caller into
|
// without any loss of context. This reduces the risk of the decoder tricking a caller into
|
||||||
// an infinite loop.
|
// an infinite loop.
|
||||||
constexpr uint32_t max_instruction_length = model >= Model::i80386 ? 15 : (model == Model::i80286 ? 10 : 65536);
|
static constexpr std::size_t max_instruction_length = model >= Model::i80386 ? 15 : (model == Model::i80286 ? 10 : 65536);
|
||||||
const uint8_t *const end = source + std::min(length, max_instruction_length - consumed_);
|
const uint8_t *const end = source + std::min(length, max_instruction_length - consumed_);
|
||||||
|
|
||||||
// MARK: - Prefixes (if present) and the opcode.
|
// MARK: - Prefixes (if present) and the opcode.
|
||||||
|
@ -44,7 +44,7 @@ template <Model model> class Decoder {
|
|||||||
The 80286 and 80386 have instruction length limits of 10 and 15 bytes respectively, so
|
The 80286 and 80386 have instruction length limits of 10 and 15 bytes respectively, so
|
||||||
cannot overflow the field.
|
cannot overflow the field.
|
||||||
*/
|
*/
|
||||||
std::pair<int, InstructionT> decode(const uint8_t *source, uint32_t length);
|
std::pair<int, InstructionT> decode(const uint8_t *source, std::size_t length);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Enables or disables 32-bit protected mode. Meaningful only if the @c Model supports it.
|
Enables or disables 32-bit protected mode. Meaningful only if the @c Model supports it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user