Message ID | 20200707095655.12880-1-tklauser@distanz.ch |
---|---|
State | Accepted |
Headers | show |
Series | include: sbi_bitops: Remove dead shift assignment in ffs/fls | expand |
> -----Original Message----- > From: opensbi <opensbi-bounces@lists.infradead.org> On Behalf Of Tobias > Klauser > Sent: 07 July 2020 15:27 > To: opensbi@lists.infradead.org > Subject: [PATCH] include: sbi_bitops: Remove dead shift assignment in ffs/fls > > The value assigned to x by the shift assignment in the last if block of ffs/fls is > never read. Remove it. > > Signed-off-by: Tobias Klauser <tklauser@distanz.ch> > --- > include/sbi/sbi_bitops.h | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index > d920086789de..879430d4b903 100644 > --- a/include/sbi/sbi_bitops.h > +++ b/include/sbi/sbi_bitops.h > @@ -66,10 +66,8 @@ static inline int ffs(int x) > x >>= 2; > r += 2; > } > - if (!(x & 1)) { > - x >>= 1; > + if (!(x & 1)) > r += 1; > - } > return r; > } > > @@ -148,10 +146,8 @@ static inline int fls(int x) > x <<= 2; > r -= 2; > } > - if (!(x & 0x80000000u)) { > - x <<= 1; > + if (!(x & 0x80000000u)) > r -= 1; > - } > return r; > } > > -- > 2.27.0 > > > -- > opensbi mailing list > opensbi@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/opensbi Looks good to me. Reviewed-by: Anup Patel <anup.patel@wdc.com> Regards, Anup
> -----Original Message----- > From: Anup Patel > Sent: 10 July 2020 15:48 > To: Tobias Klauser <tklauser@distanz.ch>; opensbi@lists.infradead.org > Subject: RE: [PATCH] include: sbi_bitops: Remove dead shift assignment in > ffs/fls > > > > > -----Original Message----- > > From: opensbi <opensbi-bounces@lists.infradead.org> On Behalf Of > > Tobias Klauser > > Sent: 07 July 2020 15:27 > > To: opensbi@lists.infradead.org > > Subject: [PATCH] include: sbi_bitops: Remove dead shift assignment in > > ffs/fls > > > > The value assigned to x by the shift assignment in the last if block > > of ffs/fls is never read. Remove it. > > > > Signed-off-by: Tobias Klauser <tklauser@distanz.ch> > > --- > > include/sbi/sbi_bitops.h | 8 ++------ > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index > > d920086789de..879430d4b903 100644 > > --- a/include/sbi/sbi_bitops.h > > +++ b/include/sbi/sbi_bitops.h > > @@ -66,10 +66,8 @@ static inline int ffs(int x) > > x >>= 2; > > r += 2; > > } > > - if (!(x & 1)) { > > - x >>= 1; > > + if (!(x & 1)) > > r += 1; > > - } > > return r; > > } > > > > @@ -148,10 +146,8 @@ static inline int fls(int x) > > x <<= 2; > > r -= 2; > > } > > - if (!(x & 0x80000000u)) { > > - x <<= 1; > > + if (!(x & 0x80000000u)) > > r -= 1; > > - } > > return r; > > } > > > > -- > > 2.27.0 > > > > > > -- > > opensbi mailing list > > opensbi@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/opensbi > > Looks good to me. > > Reviewed-by: Anup Patel <anup.patel@wdc.com> Applied this patch to the riscv/opensbi repo. Regards, Anup
diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index d920086789de..879430d4b903 100644 --- a/include/sbi/sbi_bitops.h +++ b/include/sbi/sbi_bitops.h @@ -66,10 +66,8 @@ static inline int ffs(int x) x >>= 2; r += 2; } - if (!(x & 1)) { - x >>= 1; + if (!(x & 1)) r += 1; - } return r; } @@ -148,10 +146,8 @@ static inline int fls(int x) x <<= 2; r -= 2; } - if (!(x & 0x80000000u)) { - x <<= 1; + if (!(x & 0x80000000u)) r -= 1; - } return r; }
The value assigned to x by the shift assignment in the last if block of ffs/fls is never read. Remove it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> --- include/sbi/sbi_bitops.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)