Compare commits

...

2 Commits

Author SHA1 Message Date
48ce3f281f
啊? 2024-06-24 08:55:30 +08:00
a650b0fb7f
beeeee 2024-06-24 08:52:38 +08:00

View File

@ -494,35 +494,6 @@ impl Namer {
} }
} }
} }
// let mut simd_val = self.val;
// let mut simd_val_b = self.val;
// let simd_181 = u8x32::splat(181);
// let simd_199 = u8x32::splat(199);
// let simd_128 = u8x32::splat(128);
// let simd_53 = u8x32::splat(53);
// let simd_63 = u8x32::splat(63);
// let simd_32 = u8x32::splat(32);
// for i in (0..256).step_by(32) {
// unsafe {
// let mut x = u8x32::from_slice(simd_val.get_unchecked(i..));
// let mut y = u8x32::from_slice(simd_val_b.get_unchecked(i..));
// x = (x * simd_181 + simd_199) & simd_128;
// y = (y * simd_53) & simd_63 ^ simd_32;
// x.copy_to_slice(simd_val.get_unchecked_mut(i..));
// y.copy_to_slice(simd_val_b.get_unchecked_mut(i..));
// }
// }
// let mut mod_count = 0;
// for i in 0..256 {
// 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;
let mut b: u8 = 0; let mut b: u8 = 0;
@ -571,18 +542,27 @@ impl Namer {
} }
} }
} }
if last != -1 { match last {
// self.skl_freq[last as usize] <<= 1; -1 => (),
unsafe { 14 => unsafe {
// 下面这一行应该只在 14 != 0 时运行
// 我试试优化成 *[14] / [14] 看看咋样
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
) * self.skl_freq.get_unchecked(14)
/ self.skl_freq.get_unchecked(14);
},
15 => unsafe {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
) * self.skl_freq.get_unchecked(15)
/ self.skl_freq.get_unchecked(15);
},
_ => unsafe {
*self.skl_freq.get_unchecked_mut(last as usize) <<= 1; *self.skl_freq.get_unchecked_mut(last as usize) <<= 1;
} },
// *= 2
}
if (self.skl_freq[14] != 0) && (last != 14) {
self.skl_freq[14] += min(min(self.name_base[60], self.name_base[61]), self.skl_freq[14]);
}
if (self.skl_freq[15] != 0) && (last != 15) {
self.skl_freq[15] += min(min(self.name_base[62], self.name_base[63]), self.skl_freq[15]);
} }
} }