|
|
|
@ -26,7 +26,7 @@ function serializePixels(array $pixels): string { |
|
|
|
function unserializePixels(int $n, string $serialized): array { |
|
|
|
function unserializePixels(int $n, string $serialized): array { |
|
|
|
$nBytes = intdiv($n + 7, 8); |
|
|
|
$nBytes = intdiv($n + 7, 8); |
|
|
|
if (strlen($serialized) != $nBytes) { |
|
|
|
if (strlen($serialized) != $nBytes) { |
|
|
|
$actual = strlen($serializd); |
|
|
|
$actual = strlen($serialized); |
|
|
|
throw new \ValueError("Could not unserialize a pixel bitmap: the size $actual does not equal the expected $nBytes"); |
|
|
|
throw new \ValueError("Could not unserialize a pixel bitmap: the size $actual does not equal the expected $nBytes"); |
|
|
|
} |
|
|
|
} |
|
|
|
$result = array_fill(0, $n, false); |
|
|
|
$result = array_fill(0, $n, false); |
|
|
|
|