Calculate result binary Binn string size
@return int
501736
protected function calculateSize()
    {
        $size = 0;

        if (($this->dataSize + $this->metaSize) > 127) {
            $size += 3;
        }

        if (count($this->binnArr) > 127) {
            $size += 3;
        }

        $this->size = ($this->dataSize + $this->metaSize) + $size;
        return $this->size;
    }
756259
private int getLengthFromByteArray(byte[] bin){
        ByteBuffer bb = ByteBuffer.wrap(bin);
        bb.order(ByteOrder.BIG_ENDIAN);
        return bb.getShort();
    }
938992
public static function length($bin) 
    {
        $temp  = unpack('h*', $bin);
        $bytes = $temp[1];
        $bits  = self::hex2bits($bytes);

        $count = 0;
        $i     = 0;

        while (isset($bits[$i])) {
            $count++;
            if ($bits[$i] == 1) {
                $i += 9;
            } else {
                $i += 4;
            }
        }

        return $count;
    }
765986
public function dirsize()
    {
        $size = 0;
        $directory = Folder::slashTerm($this->path);
        $stack = [$directory];
        $count = count($stack);
        for ($i = 0, $j = $count; $i < $j; $i++) {
            if (is_file($stack[$i])) {
                $size += filesize($stack[$i]);
            } elseif (is_dir($stack[$i])) {
                $dir = dir($stack[$i]);
                if ($dir) {
                    while (($entry = $dir->read()) !== false) {
                        if ($entry === '.' || $entry === '..') {
                            continue;
                        }
                        $add = $stack[$i] . $entry;

                        if (is_dir($stack[$i] . $entry)) {
                            $add = Folder::slashTerm($add);
                        }
                        $stack[] = $add;
                    }
                    $dir->close();
                }
            }
            $j = count($stack);
        }

        return $size;
    }
367290
public function getFormattedSize(): string
    {
        $kiloBytes = $this->getSize() / 1024;
        if ($kiloBytes < 1024) {
            return round($kiloBytes, 2).' KB';
        }
        $megaBytes = $kiloBytes / 1024;
        if ($megaBytes < 1024) {
            return round($megaBytes, 1).' MB';
        }

        return round($megaBytes / 1024, 1).' GB';
    }
945137
def calc_intsize(self):
        

        # assume first cross blob starts after headxml and second is one int of bytes later
        for k in self.binarychunks.iterkeys():
            if int(k.split('/')[3]) == 1 and 'cross' in k.split('/')[-1]:
                headsize = self.binarychunks[k]
                break
        for k in self.binarychunks.iterkeys():
            if int(k.split('/')[3]) == 2 and 'cross' in k.split('/')[-1]:
                intsize = self.binarychunks[k] - headsize
                break

        return (headsize, intsize)
741615
private function sizeof($any): int
    {
        if (is_object($any)) {
            $start = memory_get_usage();
            $new   = Serializer::unserialize(Serializer::serialize($any));
            $end   = memory_get_usage() - $start;
        } else if (is_bool($any)) {
            return 2;
        } else if (is_int($any)) {
            $end = PHP_INT_SIZE;
        } else if (is_float($any) || is_double($any)) {
            $end = PHP_INT_SIZE * 3;
        } else {
            $end = mb_strlen($any, '8bit');
        }

        return (int)$end;
    }
410875
public function fileSizeKB(): string
    {
        $size = $this->fileSizeBytes();
        $size = intdiv($size + 1023, 1024);

        /* I18N: size of file in KB */
        return I18N::translate('%s KB', I18N::number($size));
    }
799316
private static function sizecount($filesize) {
        if($filesize >= 1073741824) {
            $filesize = round($filesize / 1073741824 * 100) / 100 . ' G';
        } elseif($filesize >= 1048576) {
            $filesize = round($filesize / 1048576 * 100) / 100 . ' M';
        } elseif($filesize >= 1024) {
            $filesize = round($filesize / 1024 * 100) / 100 . ' K';
        } else {
            $filesize = $filesize . ' bytes';
        }
        return $filesize;
    }
368593
public function size()
    {
        $size = 0;
        if ( ! is_null($this->key_)) {
            $l = strlen($this->key_);
            $size += 1 + Protobuf::size_varint($l) + $l;
        }
        if ( ! is_null($this->value_)) {
            $l = strlen($this->value_);
            $size += 1 + Protobuf::size_varint($l) + $l;
        }

        return $size;
    }
258224
protected function packSize($size)
    {
        return ($size <= 127)
            ? $this->pack(self::BINN_UINT8, $size)
            : $this->getInt32Binsize($size);
    }
962297
public function getSize(): int
    {
        if ($this->caching == false) {
            return filesize($this->getAbsoluteFilePath());
        }

        if ($this->size == null) {
            $this->size = filesize($this->getAbsoluteFilePath());
        }

        return $this->size;
    }
1173142
public function fullByteSize()
    {
        $size = $this->byteSize();
        foreach ($this->members as $variable) {
            $size += $variable->fullByteSize();
        }
        return $size;
    }
343244
public function parseEncodedBinary()
    {
        $f = ord($this->read(1));
        if ($f <= 250) {
            return $f;
        }
        if ($f === 251) {
            return null;
        }
        if ($f === 255) {
            return false;
        }
        if ($f === 252) {
            return Binary::bytes2int($this->read(2), true);
        }
        if ($f === 253) {
            return Binary::bytes2int($this->read(3), true);
        }
        return Binary::bytes2int($this->read(8), true);
    }
1381
public static function make_human_readable_filesize($bytes) {
		$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
		$num_units = count($units);
		$size = $bytes;
		foreach ($units as $i => $unit) {
			if ($size < 1024 || (($i + 1) === $num_units)) {
				return round($size, 2).$unit;
			}
			$size = $size / 1024;
		}
		return $size;
	}
302601
public function getWidth()
    {
        if ($this->getSize() == static::SIZE_INVISIBLE) {
            return 1;
        }
        if ($this->getSize() == static::SIZE_TINY) {
            return 30;
        }

        $modifier = 0;
        if ($this->getTimeCode()) {
            $modifier = 75;
        }

        if ($this->getSize() == static::SIZE_SMALL) {
            return 150 + $modifier;
        }
        if ($this->getSize() == static::SIZE_MEDIUM) {
            return 187 + $modifier;
        }
        // static::SIZE_LARGE
        return 224 + $modifier;
    }
579691
public function getMaxHostBinary()
    {
        if ($this->network_size === 32 || $this->network_size === 31) {
            return implode('', array_map(
                function ($quad) {
                    return sprintf(self::FORMAT_BINARY, $quad);
                },
                $this->quads
            ));
        }
        return $this->maxHostCalculation(self::FORMAT_BINARY);
    }