mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Small performance improvement to nibble array re-ordering
thanks @Intyre
This commit is contained in:
parent
e2bbb76900
commit
a63020d6e5
@ -738,16 +738,12 @@ class GenericChunk implements Chunk{
|
||||
$zx = (($z << 3) | $x);
|
||||
for($y = 0; $y < 8; ++$y){
|
||||
$j = (($y << 8) | $zx);
|
||||
$result{$i++} = chr((ord($array{$j}) & 0x0f) | (ord($array{$j | 0x80}) << 4));
|
||||
}
|
||||
}
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
$zx = (($z << 3) | $x);
|
||||
for($y = 0; $y < 8; ++$y){
|
||||
$j = (($y << 8) | $zx);
|
||||
$result{$i++} = chr((ord($array{$j}) >> 4) | (ord($array{$j | 0x80}) & 0xf0));
|
||||
$result{$i} = chr((ord($array{$j}) & 0x0f) | (ord($array{$j | 0x80}) << 4));
|
||||
$result{$i + 128} = chr((ord($array{$j}) >> 4) | (ord($array{$j | 0x80}) & 0xf0));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$i += 128;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user