From 10fa61ff550a0af0534be7b5488423a7e3811048 Mon Sep 17 00:00:00 2001 From: shenjack-5600u <3695888@qq.com> Date: Thu, 25 Apr 2024 23:33:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=BC=E4=B9=8E=E8=BF=99=E6=A0=B7=E6=9B=B4?= =?UTF-8?q?=E5=A5=BD=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miner/src/name.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/miner/src/name.rs b/miner/src/name.rs index 78119c8..90fb3de 100644 --- a/miner/src/name.rs +++ b/miner/src/name.rs @@ -255,9 +255,10 @@ impl Namer { pub fn update_skill(&mut self) { let skill_id = self.skl_id.as_mut(); for i in 0..40 { - unsafe { - *skill_id.get_unchecked_mut(i) = i as u8; - } + skill_id[i] = i as u8; + // unsafe { + // *skill_id.get_unchecked_mut(i) = i as u8; + // } } #[cfg(feature = "simd")] @@ -288,16 +289,16 @@ impl Namer { let mut mod_count = 0; for i in 0..256 { - // if simd_val[i] != 0 { - // self.name_base[mod_count as usize] = simd_val_b[i]; - // mod_count += 1; - // } - unsafe { - if simd_val.get_unchecked(i) != &0 { - *self.name_base.get_unchecked_mut(mod_count as usize) = *simd_val_b.get_unchecked(i); - mod_count += 1; - } + if simd_val[i] != 0 { + self.name_base[mod_count as usize] = simd_val_b[i]; + mod_count += 1; } + // unsafe { + // if simd_val.get_unchecked(i) != &0 { + // *self.name_base.get_unchecked_mut(mod_count as usize) = *simd_val_b.get_unchecked(i); + // mod_count += 1; + // } + // } } // const int N = 256, M = 128, K = 64, skill_cnt = 40, max_len = 25; let mut a: u8 = 0;