From c2ec52a9d4b050becc309c7bce4e7979974b17cb Mon Sep 17 00:00:00 2001 From: Deskull Date: Fri, 9 Nov 2018 19:38:27 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=E3=80=80mutation=EF=BD=9Ez-u?= =?utf8?q?til=E9=96=93=E6=95=B4=E7=90=86=E3=80=82=20/=20Refactor=20between?= =?utf8?q?=20mutation=20and=20z-util.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/externs.h | 1 - src/mutation.c | 17 ----------------- src/z-util.c | 16 ++++++++++++++++ src/z-util.h | 2 ++ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/externs.h b/src/externs.h index 7b25cfe3f..0fc8538b3 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1388,7 +1388,6 @@ extern void do_cmd_gain_hissatsu(void); extern MULTIPLY mult_hissatsu(MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS mode); /* mutation.c */ -extern int count_bits(BIT_FLAGS x); extern bool gain_random_mutation(int choose_mut); extern bool lose_mutation(int choose_mut); extern void lose_all_mutations(void); diff --git a/src/mutation.c b/src/mutation.c index f47cae718..96cadc4e3 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2019,23 +2019,6 @@ void do_cmd_knowledge_mutations(void) fd_kill(file_name); } -/*! - * @brief 符号なし32ビット整数のビット数を返す。 - * @param x ビット数を調べたい変数 - * @return ビット数 - */ -int count_bits(BIT_FLAGS x) -{ - int n = 0; - - if (x) do - { - n++; - } - while (0 != (x = x&(x-1))); - - return (n); -} /*! * @brief 現在プレイヤー得ている突然変異の数を返す。 diff --git a/src/z-util.c b/src/z-util.c index 2f4c1df25..d11e8401b 100644 --- a/src/z-util.c +++ b/src/z-util.c @@ -266,3 +266,19 @@ void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2) s64b_sub(A1, A2, tmp1, tmp2); } +/*! +* @brief 符号なし32ビット整数のビット数を返す。 +* @param x ビット数を調べたい変数 +* @return ビット数 +*/ +int count_bits(BIT_FLAGS x) +{ + int n = 0; + + if (x) do + { + n++; + } while (0 != (x = x&(x - 1))); + + return (n); +} diff --git a/src/z-util.h b/src/z-util.h index 42c2f1978..088b10b52 100644 --- a/src/z-util.h +++ b/src/z-util.h @@ -64,3 +64,5 @@ extern void s64b_mod(s32b *A1, u32b *A2, s32b B1, u32b B2); #endif +extern int count_bits(BIT_FLAGS x); + -- 2.11.0