Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Replaces &str by &[u8]. (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored May 31, 2023
1 parent 8ef2dcd commit 256b617
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 156 deletions.
11 changes: 8 additions & 3 deletions src/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,13 @@ pub fn assemble<C: ContextObject>(
match statement {
Statement::Label { name } => {
if name.starts_with("function_") || name == "entrypoint" {
register_internal_function(&mut function_registry, &loader, insn_ptr, name)
.map_err(|_| format!("Label hash collision {name}"))?;
register_internal_function(
&mut function_registry,
&loader,
insn_ptr,
name.as_bytes(),
)
.map_err(|_| format!("Label hash collision {name}"))?;
}
labels.insert(name.as_str(), insn_ptr);
}
Expand Down Expand Up @@ -291,7 +296,7 @@ pub fn assemble<C: ContextObject>(
&mut function_registry,
&loader,
target_pc as usize,
label,
label.as_bytes(),
)
.map_err(|_| format!("Label hash collision {name}"))?;
insn(opc, 0, 1, 0, target_pc)
Expand Down
Loading

0 comments on commit 256b617

Please sign in to comment.