protected function patchDeltaHeaderSize($delta, $pos)
{
$size = 0;
$shift = 0;
do {
$c = ord($delta[$pos]);
if (!$c) {
throw new InvalidPackfileException("Packfile delta header is invalid");
}
$pos++;
$size |= ($c & 0x7f) << $shift;
$shift += 7;
} while ($c & 0x80);
return array($size, $pos);
}