Skip to content

Commit

Permalink
Better names
Browse files Browse the repository at this point in the history
  • Loading branch information
gzanitti committed Nov 30, 2023
1 parent beb28b8 commit f0427f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions etk-asm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,29 +460,29 @@ impl Assembler {
continue;
}

let pos = labeldef.position;
// We check if the label is used in a dynamic push.
if let Some(value) =
if let Some(times) =
self.labeled_dynamic_pushes.get_mut(label)
{
// If the label is used in a dynamic push, we need to
// multiply the final resolved value of the label by
// the number of times the label is used in dynamic
// pushes (to update the size of the bytecode accordingly).
self.concrete_len += (push_size - 1) * *value;
self.concrete_len += (push_size - 1) * *times;
*label_value = Some(LabelDef {
position: labeldef.position
+ *value * (push_size - 1),
position: pos + *times * (push_size - 1),
updated: true,
});
acum += *value * (push_size - 1);
acum += *times * (push_size - 1);
} else {
// If the label is not used in a dynamic push, we
// simply update the size of the push operation.
// Since ´declared_labels' is ordered by insertion
// we can simply add the accumulated size to the
// actual position of the label.
*label_value = Some(LabelDef {
position: labeldef.position + acum,
position: pos + acum,
updated: true,
});
}
Expand Down

0 comments on commit f0427f4

Please sign in to comment.