mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2025-12-24 00:06:22 +01:00
Use full names for files
This commit is contained in:
parent
8c1ab76ce5
commit
0863cd49c9
4 changed files with 0 additions and 0 deletions
36
src/literal-number.cpp
Normal file
36
src/literal-number.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* This file is part of the sirit project.
|
||||
* Copyright (c) 2018 ReinUsesLisp
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* Lesser General Public License version 2.1 or any later version.
|
||||
*/
|
||||
|
||||
#include "lnumber.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Sirit {
|
||||
|
||||
LiteralNumber::LiteralNumber(std::type_index type) : type(type) {
|
||||
operand_type = OperandType::Number;
|
||||
}
|
||||
|
||||
LiteralNumber::~LiteralNumber() = default;
|
||||
|
||||
void LiteralNumber::Fetch(Stream& stream) const {
|
||||
if (is_32) {
|
||||
stream.Write(static_cast<u32>(raw));
|
||||
} else {
|
||||
stream.Write(raw);
|
||||
}
|
||||
}
|
||||
|
||||
u16 LiteralNumber::GetWordCount() const { return is_32 ? 1 : 2; }
|
||||
|
||||
bool LiteralNumber::operator==(const Operand& other) const {
|
||||
if (operand_type == other.GetType()) {
|
||||
const auto& o{dynamic_cast<const LiteralNumber&>(other)};
|
||||
return o.type == type && o.raw == raw;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Sirit
|
||||
Loading…
Add table
Add a link
Reference in a new issue