projects
/
libreriscv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
15c3708
)
(no commit message)
author
lkcl
<lkcl@web>
Wed, 26 Apr 2023 15:25:53 +0000
(16:25 +0100)
committer
IkiWiki
<ikiwiki.info>
Wed, 26 Apr 2023 15:25:53 +0000
(16:25 +0100)
openpower/sv/cookbook/pospopcnt.mdwn
[new file with mode: 0644]
patch
|
blob
diff --git a/openpower/sv/cookbook/pospopcnt.mdwn
b/openpower/sv/cookbook/pospopcnt.mdwn
new file mode 100644
(file)
index 0000000..
d288971
--- /dev/null
+++ b/
openpower/sv/cookbook/pospopcnt.mdwn
@@ -0,0
+1,21
@@
+<https://bugs.libre-soc.org/show_bug.cgi?id=672>
+
+```
+func count8safe(counts *[8]int, buf []uint8) {
+ for i := range buf {
+ for j := 0; j < 8; j++ {
+ counts[j] += int(buf[i] >> j & 1)
+ }
+ }
+}
+
+func count16safe(counts *[16]int, buf []uint16) {
+ for i := range buf {
+ for j := 0; j < 16; j++ {
+ counts[j] += int(buf[i] >> j & 1)
+ }
+ }
+}
+```
+
+[[!tag svp64_cookbook ]]