Not sure the comments here really help anything.  What could buffer(offset) = result do except add the result to the buffer?  Better to just remove the comments and have one statement per line (i.e. put offset += 1 on its own line)