Skip to content

Commit

Permalink
Remove auto function return type
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Jun 1, 2024
1 parent e463986 commit 2a852f0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/asm_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ Error Assembler::defineDataConstant(StrScanner &scan, Insn &insn, uint8_t dataTy
}

namespace {
auto convert2pbcd(uint64_t bin, uint8_t digits) {
uint64_t convert2pbcd(uint64_t bin, uint8_t digits) {
uint64_t pbcd = 0;
uint8_t shift = 0;
while (digits-- > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/entry_mc68000.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ struct Entry final : entry::Base<Config::opcode_t> {
OprSize oprSize() const { return OprSize((_size >> oprSize_gp) & size_gm); }
InsnSize insnSize() const { return InsnSize((_size >> insnSize_gp) & size_gm); }
bool hasPostVal() const { return (_src & hasPostVal_bm) != 0; }
auto postVal() const { return _postVal; }
Config::opcode_t postVal() const { return _postVal; }

void setAddrMode(AddrMode src, AddrMode dst) {
_src = static_cast<uint8_t>(src | (_src & hasPostVal_bm));
_dst = static_cast<uint8_t>(dst);
}
void setInsnSize(InsnSize size) { _size = Entry::_size(oprSize(), size); }
auto postMask() const { return postMask(dstPos()) | postMask(srcPos()); }
Config::opcode_t postMask() const { return postMask(dstPos()) | postMask(srcPos()); }
static Config::opcode_t postMask(OprPos pos);
};

Expand Down
34 changes: 19 additions & 15 deletions src/insn_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,42 +452,46 @@ struct DisInsnBase : ErrorAt {
template <typename Conf, typename Entry>
struct EntryInsnBase {
EntryInsnBase() : _opCode(0), _flags() {}
void setOpCode(typename Conf::opcode_t opCode) { _opCode = opCode; }
typename Conf::opcode_t opCode() const { return _opCode; }
void embed(typename Conf::opcode_t data) { _opCode |= data; }
void setFlags(typename Entry::Flags flags) { _flags = flags; }
typename Entry::Flags flags() const { return _flags; }
typename Entry::Flags &flags() { return _flags; }
using opcode_t = typename Conf::opcode_t;
using Flags = typename Entry::Flags;
void setOpCode(opcode_t opCode) { _opCode = opCode; }
opcode_t opCode() const { return _opCode; }
void embed(opcode_t data) { _opCode |= data; }
void setFlags(Flags flags) { _flags = flags; }
Flags flags() const { return _flags; }
Flags &flags() { return _flags; }

private:
typename Conf::opcode_t _opCode;
typename Entry::Flags _flags;
opcode_t _opCode;
Flags _flags;
};

template <typename Conf, typename Entry>
struct EntryInsnPrefix : virtual EntryInsnBase<Conf, Entry> {
EntryInsnPrefix() : _prefix(0) {}
void setPrefix(typename Conf::opcode_t prefix) { _prefix = prefix; }
using opcode_t = typename Conf::opcode_t;
void setPrefix(opcode_t prefix) { _prefix = prefix; }
bool hasPrefix() const { return _prefix != 0; }
auto prefix() const { return _prefix; }
opcode_t prefix() const { return _prefix; }

private:
typename Conf::opcode_t _prefix;
opcode_t _prefix;
};

template <typename Conf, typename Entry>
struct EntryInsnPostfix : virtual EntryInsnBase<Conf, Entry> {
EntryInsnPostfix() : _postfix(0), _hasPostfix(false) {}
void setPostfix(typename Conf::opcode_t postfix, bool hasPostfix = true) {
using opcode_t = typename Conf::opcode_t;
void setPostfix(opcode_t postfix, bool hasPostfix = true) {
_postfix = postfix;
_hasPostfix = hasPostfix;
}
void embedPostfix(typename Conf::opcode_t data) { setPostfix(_postfix | data); }
void embedPostfix(opcode_t data) { setPostfix(_postfix | data); }
bool hasPostfix() const { return _hasPostfix; }
auto postfix() const { return _postfix; }
opcode_t postfix() const { return _postfix; }

private:
typename Conf::opcode_t _postfix;
opcode_t _postfix;
bool _hasPostfix;
};

Expand Down
6 changes: 3 additions & 3 deletions src/insn_i8086.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ struct EntryInsn : EntryInsnPrefix<Config, Entry> {
bool fpuInst() const { return flags().fpuInst(); }

void setSegment(Config::opcode_t segment) { _segment = segment; }
auto segment() const { return _segment; }
Config::opcode_t segment() const { return _segment; }
void setFwait(bool enable = true) { _fwait = enable ? FWAIT : 0; }
auto fwait() const { return _fwait; }
Config::opcode_t fwait() const { return _fwait; }

static constexpr Config::opcode_t FWAIT = 0x9B;

Expand Down Expand Up @@ -157,7 +157,7 @@ struct DisInsn final : DisInsnImpl<Config>, EntryInsn {
else if (dst == P_OMOD || src == P_OMOD)
_modReg = opCode();
}
auto modReg() const { return _modReg; }
Config::opcode_t modReg() const { return _modReg; }

private:
Config::opcode_t _modReg;
Expand Down
2 changes: 1 addition & 1 deletion src/insn_mc68000.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct EntryInsn : EntryInsnPostfix<Config, Entry> {
OprPos dstPos() const { return flags().dstPos(); }
OprSize oprSize() const { return flags().oprSize(); }
bool hasPostVal() const { return flags().hasPostVal(); }
auto postVal() const { return flags().postVal(); }
Config::opcode_t postVal() const { return flags().postVal(); }
};

struct AsmInsn;
Expand Down
2 changes: 1 addition & 1 deletion src/insn_mc6809.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct AsmInsn final : AsmInsnImpl<Config>, EntryInsn {
struct DisInsn final : DisInsnImpl<Config>, EntryInsn {
DisInsn(Insn &insn, DisMemory &memory, const StrBuffer &out) : DisInsnImpl(insn, memory, out) {}

auto readPostfix() {
Config::opcode_t readPostfix() {
if (!hasPostfix())
setPostfix(readByte());
return postfix();
Expand Down

0 comments on commit 2a852f0

Please sign in to comment.