Skip to content

Instantly share code, notes, and snippets.

@moritz
Created October 23, 2011 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/1307615 to your computer and use it in GitHub Desktop.
Save moritz/1307615 to your computer and use it in GitHub Desktop.
PIR version of Buf concatenation segfault
.sub bb
$P0 = new 'ByteBuffer'
$P0 = 100
$I0 = 0
loop:
$I1 = $I0 + 1
$P0[$I0] = $I1
inc $I0
unless $I0 == 100 goto loop
.return ($P0)
.end
.sub main :main
$P0 = new 'ByteBuffer'
$P0 = 1
$P0[0] = 1
$I0 = 0
loop:
$P1 = 'bb'()
$S0 = $P0.'get_string'('binary')
$S1 = $P1.'get_string'('binary')
$S0 = concat $S0, $S1
$P0 = new 'ByteBuffer'
$P0 = $S0
inc $I0
unless $I0 == 1000 goto loop
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment