What do you want to do with this JB code?

Source: Internet
Author: User
What does this JB code really want?

$LN = $this->lengthindicator ($this->qr_mode_nm, $this->version);
$dif = $this->estimatebitsmodenum ($run) + 4 + $LN
+ $this->estimatebitsmode8 (1)//+ 4 + L8
-$this->estimatebitsmode8 ($run + 1); -4-l8
if ($dif > 0) {
return $this->eat8 ();
}

function Estimatebitsmodenum ($size) {
$w = (int) $size/3;
$bits = $w * 10;
Switch ($size-$w * 3) {
Case 1: {
$bits + = 4;
Break
}
Case 2: {
$bits + = 7;
Break
}
Default: {
Break
}
}
return $bits;
}

function EstimateBitsMode8 ($size) {
return $size * 8;
}


function Lengthindicator ($mode, $version) {
if ($mode = = $this->qr_mode_st) {
return 0;
}
if ($version <= 9) {
$l = 0;
} elseif ($version <= 26) {
$l = 1;
} else {
$l = 2;
}
return $this->lengthtablebits[$mode [$l];
}

$lengthTableBits = Array (
Array (10, 12, 14),
Array (9, 11, 13),
Array (8, 16, 16),
Array (8, 10, 12)
);

------Solution--------------------
Do not understand the principle of two-dimensional code, see the code can read it?
Numeric mode digital code, from 0 to 9. If the number of digits that need to be encoded is not a multiple of 3, then the last remaining 1 or 2 digits will be converted to 4 or 7bits, then each of the other 3 digits will be 10,12,14bits corresponding to your Estimatebitsmodenum
Number of digits encoded under different version:
correspond to your Lengthindicator

I don't understand, help you find the information: Http://coolshell.cn/articles/10590.html#jtss-tsina
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.