似乎这样更好?

This commit is contained in:
shenjack-5600u 2024-04-25 23:33:24 +08:00 committed by shenjack
parent f2f42af0f8
commit 10fa61ff55
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -255,9 +255,10 @@ impl Namer {
pub fn update_skill(&mut self) { pub fn update_skill(&mut self) {
let skill_id = self.skl_id.as_mut(); let skill_id = self.skl_id.as_mut();
for i in 0..40 { for i in 0..40 {
unsafe { skill_id[i] = i as u8;
*skill_id.get_unchecked_mut(i) = i as u8; // unsafe {
} // *skill_id.get_unchecked_mut(i) = i as u8;
// }
} }
#[cfg(feature = "simd")] #[cfg(feature = "simd")]
@ -288,16 +289,16 @@ impl Namer {
let mut mod_count = 0; let mut mod_count = 0;
for i in 0..256 { for i in 0..256 {
// if simd_val[i] != 0 { if simd_val[i] != 0 {
// self.name_base[mod_count as usize] = simd_val_b[i]; self.name_base[mod_count as usize] = simd_val_b[i];
// mod_count += 1; 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;
}
} }
// 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; // const int N = 256, M = 128, K = 64, skill_cnt = 40, max_len = 25;
let mut a: u8 = 0; let mut a: u8 = 0;