<?php namespace App\Traits; trait CRC { private function CRC16USD_UPDATE(int $b,int $crc): int { return (self::crc16usd_tab[(($crc >> 8) ^ $b) & 0xff] ^ (($crc & 0x00ff) << 8)) & 0xffff; } private function CRC32_CR(int $c,int $b) { return (self::crc32_tab[((int)($c) ^ ($b)) & 0xff] ^ (($c) >> 8)); } private function CRC32_FINISH(int $crc) { return ~$crc & 0xffffffff; } private function CRC32_UPDATE(int $b,int $crc) { return ((self::crc32_tab[($crc^$b) & 0xff] ^ (($crc>>8) & 0x00ffffff)) & 0xffffffff); } private function LSZ_INIT_CRC() { return ($this->ls_Protocol & self::LSZ_OPTCRC32) ? self::LSZ_INIT_CRC32 : self::LSZ_INIT_CRC16; } private function LSZ_FINISH_CRC(int $crc) { return ($this->ls_Protocol & self::LSZ_OPTCRC32) ? $this->CRC32_FINISH($crc) : $crc; } private function LSZ_UPDATE_CRC(int $b,int $crc) { return ($this->ls_Protocol & self::LSZ_OPTCRC32) ? $this->CRC32_UPDATE($b,$crc) : $this->CRC16USD_UPDATE($b,$crc); } }