From: lkcl Date: Wed, 2 Oct 2019 07:31:32 +0000 (+0100) Subject: (no commit message) X-Git-Tag: convert-csv-opcode-to-binary~3930 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=115f34a704e517ffc503355145f86e955438c7a6;p=libreriscv.git --- diff --git a/simple_v_extension/specification/bitmanip.mdwn b/simple_v_extension/specification/bitmanip.mdwn index 25acef469..d38b4246f 100644 --- a/simple_v_extension/specification/bitmanip.mdwn +++ b/simple_v_extension/specification/bitmanip.mdwn @@ -80,6 +80,15 @@ output instruction pseudoinstruction population-count +Pseudocode: + + unsigned int v; // count the number of bits set in v + unsigned int c; // c accumulates the total bits set in v + for (c = 0; v; c++) + { + v &= v - 1; // clear the least significant bit set + } + ## ffirst - find first bit finds the first bit set as an index.