本站源代码
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
669B

  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. }
上海开阖软件有限公司 沪ICP备12045867号-1