diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-01 15:58:53 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-01 20:10:06 -0700 |
commit | a49bc41365bf6b4f0c006c5fbdcb4b519634c42c (patch) | |
tree | 664075c7652dfe7eb75cfdb6c54e7b226215bc2d /subx/030---operands.cc | |
parent | 6ff9ce26e84f686a96ada723f63ce95879216cca (diff) | |
download | mu-a49bc41365bf6b4f0c006c5fbdcb4b519634c42c.tar.gz |
4531 - automatically compute segment addresses
Diffstat (limited to 'subx/030---operands.cc')
-rw-r--r-- | subx/030---operands.cc | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/subx/030---operands.cc b/subx/030---operands.cc index 3e103b66..6fa2354d 100644 --- a/subx/030---operands.cc +++ b/subx/030---operands.cc @@ -430,37 +430,6 @@ bool is_hex_int(const string& s) { return s.find_first_not_of("0123456789abcdefABCDEF", pos) == string::npos; } -int32_t parse_int(const string& s) { - if (s.empty()) return 0; - istringstream in(s); - in >> std::hex; - if (s.at(0) == '-') { - int32_t result = 0; - in >> result; - if (!in || !in.eof()) { - raise << "not a number: " << s << '\n' << end(); - return 0; - } - return result; - } - uint32_t uresult = 0; - in >> uresult; - if (!in || !in.eof()) { - raise << "not a number: " << s << '\n' << end(); - return 0; - } - return static_cast<int32_t>(uresult); -} -:(before "End Unit Tests") -void test_parse_int() { - CHECK_EQ(0, parse_int("0")); - CHECK_EQ(0, parse_int("0x0")); - CHECK_EQ(0, parse_int("0x0")); - CHECK_EQ(16, parse_int("10")); // hex always - CHECK_EQ(-1, parse_int("-1")); - CHECK_EQ(-1, parse_int("0xffffffff")); -} - :(code) string to_string(const line& inst) { ostringstream out; |