Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Adds dedicated integer computation

Author Dave Jarvis <email>
Date 2026-02-21 21:14:58 GMT-0800
Commit 46a28e15a545fc202f20f230a28dab4ffe83217e
Parent c010121
git/PackContext.php
}
+ public function computeIntDedicated( callable $callback, int $default ): int {
+ return $this->manager->computeIntDedicated(
+ $this->packFile,
+ function( StreamReader $stream ) use ( $callback ): int {
+ return $callback( $stream, $this->offset );
+ },
+ $default
+ );
+ }
+
public function computeStringDedicated(
callable $callback,
git/PackEntryReader.php
public function getSize( PackContext $context ): int {
- return $context->computeInt(
+ return $context->computeIntDedicated(
function( StreamReader $stream, int $offset ): int {
$stream->seek( $offset );
git/PackStreamManager.php
}
+ public function computeIntDedicated(
+ string $path,
+ callable $callback,
+ int $default
+ ): int {
+ $result = $default;
+ $reader = BufferedReader::open( $path );
+
+ if( $reader->isOpen() ) {
+ $result = $callback( $reader );
+ }
+
+ return $result;
+ }
+
public function computeStringDedicated(
string $path,
Delta 26 lines added, 1 line removed, 25-line increase