History

risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap()

bitmap_empty() is better than bitmap_weight() because it may return earlier, and improves on readability.

Yury Norov committed 4 years ago

Commit 8f515581 parent 5f8dac31 file · +3 −4Browse files

Unified · Split

arch/riscv/kernel/cpufeature.c+3−4
@@ -206,11 +206,10 @@ void __init riscv_fill_hwcap(void) · 205 unmodified lines
206 else206 else
207 elf_hwcap = this_hwcap;207 elf_hwcap = this_hwcap;
208 208
209 if (bitmap_weight(riscv_isa, RISCV_ISA_EXT_MAX))209 if (bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX))
210 bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
211 else
212 bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX);210 bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
213 211 else
212 bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
214 }213 }
215 214
216 /* We don't support systems with F but without D, so mask those out215 /* We don't support systems with F but without D, so mask those out

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t