From d4da3b42779dd14c33fc9a6d71ea438a6373d6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Wed, 17 Jun 2026 09:06:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20placement.rs=20=E2=80=94=20actual=5Fcol?= =?UTF-8?q?=3D=3D0=20=E6=97=B6=E4=B8=8B=E6=BA=A2=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/matrix/placement.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/core/src/matrix/placement.rs b/core/src/matrix/placement.rs index afc1b74..f26369c 100644 --- a/core/src/matrix/placement.rs +++ b/core/src/matrix/placement.rs @@ -34,13 +34,15 @@ pub fn place_data(matrix: &mut Matrix, codewords: &[u8]) { if bit_idx >= bits.len() { break; } - place_bit( - matrix, - (actual_col - 1) as u8, - row as u8, - bits[bit_idx], - &mut bit_idx, - ); + if actual_col > 0 { + place_bit( + matrix, + (actual_col - 1) as u8, + row as u8, + bits[bit_idx], + &mut bit_idx, + ); + } } } else { for row in 0..size { @@ -57,13 +59,15 @@ pub fn place_data(matrix: &mut Matrix, codewords: &[u8]) { if bit_idx >= bits.len() { break; } - place_bit( - matrix, - (actual_col - 1) as u8, - row as u8, - bits[bit_idx], - &mut bit_idx, - ); + if actual_col > 0 { + place_bit( + matrix, + (actual_col - 1) as u8, + row as u8, + bits[bit_idx], + &mut bit_idx, + ); + } } }