You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

popcnt_slices.go 669B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package roaring
  2. func popcntSliceGo(s []uint64) uint64 {
  3. cnt := uint64(0)
  4. for _, x := range s {
  5. cnt += popcount(x)
  6. }
  7. return cnt
  8. }
  9. func popcntMaskSliceGo(s, m []uint64) uint64 {
  10. cnt := uint64(0)
  11. for i := range s {
  12. cnt += popcount(s[i] &^ m[i])
  13. }
  14. return cnt
  15. }
  16. func popcntAndSliceGo(s, m []uint64) uint64 {
  17. cnt := uint64(0)
  18. for i := range s {
  19. cnt += popcount(s[i] & m[i])
  20. }
  21. return cnt
  22. }
  23. func popcntOrSliceGo(s, m []uint64) uint64 {
  24. cnt := uint64(0)
  25. for i := range s {
  26. cnt += popcount(s[i] | m[i])
  27. }
  28. return cnt
  29. }
  30. func popcntXorSliceGo(s, m []uint64) uint64 {
  31. cnt := uint64(0)
  32. for i := range s {
  33. cnt += popcount(s[i] ^ m[i])
  34. }
  35. return cnt
  36. }