Maison > Article > développement back-end > 这JB代码终究想干嘛
这JB代码到底想干嘛?
<br />$ln = $this->lengthIndicator($this->QR_MODE_NM, $this->version);<br />$dif = $this->estimateBitsModeNum($run) + 4 + $ln<br /> + $this->estimateBitsMode8(1) // + 4 + l8<br /> - $this->estimateBitsMode8($run + 1); // - 4 - l8<br /> if ($dif > 0) {<br /> return $this->eat8();<br /> }<br /><br />function estimateBitsModeNum($size) {<br /> $w = (int)$size / 3;<br /> $bits = $w * 10;<br /> switch($size - $w * 3) {<br /> case 1: {<br /> $bits += 4;<br /> break;<br /> }<br /> case 2: {<br /> $bits += 7;<br /> break;<br /> }<br /> default: {<br /> break;<br /> }<br /> }<br /> return $bits;<br /> }<br /><br />function estimateBitsMode8($size) {<br /> return $size * 8;<br /> }<br /><br /><br />function lengthIndicator($mode, $version) {<br /> if ($mode == $this->QR_MODE_ST) {<br /> return 0;<br /> }<br /> if ($version <= 9) {<br /> $l = 0;<br /> } elseif ($version <= 26) {<br /> $l = 1;<br /> } else {<br /> $l = 2;<br /> }<br /> return $this->lengthTableBits[$mode][$l];<br /> }<br /><br />$lengthTableBits = array(<br /> array(10, 12, 14),<br /> array( 9, 11, 13),<br /> array( 8, 16, 16),<br /> array( 8, 10, 12)<br /> );