[PATCH] spi: use is_power_of_2 instead of hweight32 in spi_nor_write()

Jagan Teki jagan at amarulasolutions.com
Fri Apr 3 16:52:21 CEST 2020


On Fri, Mar 13, 2020 at 5:37 AM Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> hweight32 is a somewhat expensive way to check for power-of-2. Use the
> is_power_of_2 helper, which does the standard and cheap idiom
> foo&(foo-1)==0.
>
> add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-96 (-96)
> Function                                     old     new   delta
> spi_nor_write                                388     292     -96
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---

Applied to u-boot-spi/master


More information about the U-Boot mailing list