MCPcopy Create free account
hub / github.com/codemistic/Web-Development / newFromNum

Method newFromNum

text-to-qr/lib/phpqrcode/phpqrcode.php:1795–1811  ·  view source on GitHub ↗

----------------------------------------------------------------------

($bits, $num)

Source from the content-addressed store, hash-verified

1793
1794 //----------------------------------------------------------------------
1795 public static function newFromNum($bits, $num)
1796 {
1797 $bstream = new QRbitstream();
1798 $bstream->allocate($bits);
1799
1800 $mask = 1 << ($bits - 1);
1801 for($i=0; $i<$bits; $i++) {
1802 if($num & $mask) {
1803 $bstream->data[$i] = 1;
1804 } else {
1805 $bstream->data[$i] = 0;
1806 }
1807 $mask = $mask >> 1;
1808 }
1809
1810 return $bstream;
1811 }
1812
1813 //----------------------------------------------------------------------
1814 public static function newFromBytes($size, $data)

Callers 1

appendNumMethod · 0.45

Calls 1

allocateMethod · 0.45

Tested by

no test coverage detected