Skip to content
Snippets Groups Projects
strset.hir 567 B
fn strset<1>(str: array(u8, #0), byte: u8) -> array(u8, #0)
  zero = constant(u64, 0)
  one = constant(u64, 1)
  bound = dynamic_constant(#0)
  loop = region(start, if_true)
  idx = phi(loop, zero, idx_inc)
  str_inc = phi(loop, str, write)
  idx_inc = add(idx, one)
  in_bounds = lt(idx_inc, bound)
  read = read(str_inc, position(idx))
  write = write(str_inc, byte, position(idx))
  continue = ne(read, byte)
  if_cond = and(continue, in_bounds)
  if = if(loop, if_cond)
  if_false = projection(if, 0)
  if_true = projection(if, 1)
  r = return(if_false, str_inc)