count number of buffer bytes copied manually