From 642488cb6463176ab85e4b4c0d617694724003b8 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 9 Jun 2023 15:42:13 +0200 Subject: [PATCH] fixed --- hbasm/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hbasm/src/lib.rs b/hbasm/src/lib.rs index 681fd76..36cc276 100644 --- a/hbasm/src/lib.rs +++ b/hbasm/src/lib.rs @@ -92,8 +92,8 @@ macro_rules! expect_matches { pub fn assembly(code: &str, buf: &mut Vec) -> Result<(), Error> { struct Assembler<'a> { - lexer: Lexer<'a, Token>, - buf: &'a mut Vec, + lexer: Lexer<'a, Token>, + buf: &'a mut Vec, lblmap: HashMap, subset: HashSet, } @@ -165,7 +165,7 @@ pub fn assembly(code: &str, buf: &mut Vec) -> Result<(), Error> { let imm = match imm { Token::Integer(n) => n.to_le_bytes(), Token::Symbol(s) => { - self.subset.insert(self.buf.len() - 1); + self.subset.insert(self.buf.len()); s.into_usize().to_le_bytes() } _ => unreachable!(), @@ -188,8 +188,8 @@ pub fn assembly(code: &str, buf: &mut Vec) -> Result<(), Error> { let imm = match imm { Token::Integer(n) => n.to_le_bytes(), Token::Symbol(s) => { - self.subset.insert(self.buf.len() - 1); - (s.into_inner().get() as usize).to_le_bytes() + self.subset.insert(self.buf.len()); + s.into_usize().to_le_bytes() } _ => unreachable!(), };