From 48ce3f281f3a00ca02936d33e97ada8dd9ca50ee Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 24 Jun 2024 08:55:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8A=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miner/src/name.rs | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/miner/src/name.rs b/miner/src/name.rs index d9ade78..61d1c36 100644 --- a/miner/src/name.rs +++ b/miner/src/name.rs @@ -542,18 +542,27 @@ impl Namer { } } } - if last != -1 { - // self.skl_freq[last as usize] <<= 1; - unsafe { + 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 { + *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; - } - // *= 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]); + }, } }