Compare commits

..

No commits in common. "421ac1a56621b55464cd5586b03015b94f84792e" and "4a221f92faf6c7904d7634d5915e63a673b60ada" have entirely different histories.

View File

@ -542,77 +542,26 @@ impl Namer {
}
}
}
// match last {
// -1 => (),
// 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 {
// if self.skl_freq.get_unchecked(15) != 0 { *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))}
// );
// },
// _ => unsafe {
// *self.skl_freq.get_unchecked_mut(last as usize) <<= 1;
// },
// }
match last {
-1 => unsafe {
// 判断 14, 15 去
if *self.skl_freq.get_unchecked(14) != 0 {
*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),
)
}
if *self.skl_freq.get_unchecked(15) != 0 {
*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),
)
}
},
-1 => (),
14 => unsafe {
// 判断 15
*self.skl_freq.get_unchecked_mut(14) <<= 1;
if *self.skl_freq.get_unchecked(15) != 0 {
*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),
)
}
// 下面这一行应该只在 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 {
// 判断 14
*self.skl_freq.get_unchecked_mut(15) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*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_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);
},
x => unsafe {
*self.skl_freq.get_unchecked_mut(x as usize) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*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),
)
}
if *self.skl_freq.get_unchecked(15) != 0 {
*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),
)
}
_ => unsafe {
*self.skl_freq.get_unchecked_mut(last as usize) <<= 1;
},
}
}
@ -819,10 +768,10 @@ mod test {
fn update_name_test() {
// 先创建一个正常的 namer
// 然后更新名字
let team = TeamNamer::new_unchecked("shenjack");
let team = TeamNamer::new_unchecked("x");
let mut namer = Namer::new_from_team_namer_unchecked(&team, "x");
let update_name = "一一一丑堀㴁";
let update_name = "k";
namer.replace_name(&team, update_name);
let mut none_update_name = Namer::new_from_team_namer_unchecked(&team, update_name);