mirror of
https://gitee.com/openharmony/third_party_qrcodegen
synced 2024-11-23 07:10:22 +00:00
Tweaked some of QrSegment.makeEci()'s integer literals to binary notations in most language ports.
This commit is contained in:
parent
86a49ba597
commit
50f0c4b5bc
@ -151,10 +151,10 @@ public final class QrSegment {
|
||||
else if (assignVal < (1 << 7))
|
||||
bb.appendBits(assignVal, 8);
|
||||
else if (assignVal < (1 << 14)) {
|
||||
bb.appendBits(2, 2);
|
||||
bb.appendBits(0b10, 2);
|
||||
bb.appendBits(assignVal, 14);
|
||||
} else if (assignVal < 1_000_000) {
|
||||
bb.appendBits(6, 3);
|
||||
bb.appendBits(0b110, 3);
|
||||
bb.appendBits(assignVal, 21);
|
||||
} else
|
||||
throw new IllegalArgumentException("ECI assignment value out of range");
|
||||
|
@ -746,10 +746,10 @@ class QrSegment:
|
||||
elif assignval < (1 << 7):
|
||||
bb.append_bits(assignval, 8)
|
||||
elif assignval < (1 << 14):
|
||||
bb.append_bits(2, 2)
|
||||
bb.append_bits(0b10, 2)
|
||||
bb.append_bits(assignval, 14)
|
||||
elif assignval < 1000000:
|
||||
bb.append_bits(6, 3)
|
||||
bb.append_bits(0b110, 3)
|
||||
bb.append_bits(assignval, 21)
|
||||
else:
|
||||
raise ValueError("ECI assignment value out of range")
|
||||
|
@ -1059,10 +1059,10 @@ impl QrSegment {
|
||||
if assignval < (1 << 7) {
|
||||
bb.append_bits(assignval, 8);
|
||||
} else if assignval < (1 << 14) {
|
||||
bb.append_bits(2, 2);
|
||||
bb.append_bits(0b10, 2);
|
||||
bb.append_bits(assignval, 14);
|
||||
} else if assignval < 1_000_000 {
|
||||
bb.append_bits(6, 3);
|
||||
bb.append_bits(0b110, 3);
|
||||
bb.append_bits(assignval, 21);
|
||||
} else {
|
||||
panic!("ECI assignment value out of range");
|
||||
|
@ -811,10 +811,10 @@ namespace qrcodegen {
|
||||
else if (assignVal < (1 << 7))
|
||||
appendBits(assignVal, 8, bb);
|
||||
else if (assignVal < (1 << 14)) {
|
||||
appendBits(2, 2, bb);
|
||||
appendBits(0b10, 2, bb);
|
||||
appendBits(assignVal, 14, bb);
|
||||
} else if (assignVal < 1000000) {
|
||||
appendBits(6, 3, bb);
|
||||
appendBits(0b110, 3, bb);
|
||||
appendBits(assignVal, 21, bb);
|
||||
} else
|
||||
throw "ECI assignment value out of range";
|
||||
|
Loading…
Reference in New Issue
Block a user