File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1302,6 +1302,14 @@ func TestUnion(t *testing.T) {
13021302 }
13031303}
13041304
1305+ func TestEmptyUnionCardinality (t * testing.T ) {
1306+ a := New (0 )
1307+ b := New (0 )
1308+ if a .UnionCardinality (b ) != 0 {
1309+ t .Error ("UnionCardinality should be zero" )
1310+ }
1311+ }
1312+
13051313func TestInPlaceUnion (t * testing.T ) {
13061314 a := New (100 )
13071315 b := New (200 )
@@ -1353,6 +1361,14 @@ func TestIntersection(t *testing.T) {
13531361 }
13541362}
13551363
1364+ func TestEmptyIntersectionCardinality (t * testing.T ) {
1365+ a := New (0 )
1366+ b := New (0 )
1367+ if a .IntersectionCardinality (b ) != 0 {
1368+ t .Error ("IntersectionCardinality should be zero" )
1369+ }
1370+ }
1371+
13561372func TestInplaceIntersection (t * testing.T ) {
13571373 a := New (100 )
13581374 b := New (200 )
@@ -1408,6 +1424,14 @@ func TestDifference(t *testing.T) {
14081424 }
14091425}
14101426
1427+ func TestEmptyDifferenceCardinality (t * testing.T ) {
1428+ a := New (0 )
1429+ b := New (0 )
1430+ if a .DifferenceCardinality (b ) != 0 {
1431+ t .Error ("DifferenceCardinality should be zero" )
1432+ }
1433+ }
1434+
14111435func TestInPlaceDifference (t * testing.T ) {
14121436 a := New (100 )
14131437 b := New (200 )
@@ -1463,6 +1487,14 @@ func TestSymmetricDifference(t *testing.T) {
14631487 }
14641488}
14651489
1490+ func TestEmptySymmetricDifferenceCardinality (t * testing.T ) {
1491+ a := New (0 )
1492+ b := New (0 )
1493+ if a .SymmetricDifferenceCardinality (b ) != 0 {
1494+ t .Error ("SymmetricDifferenceCardinality should be zero" )
1495+ }
1496+ }
1497+
14661498func TestInPlaceSymmetricDifference (t * testing.T ) {
14671499 a := New (100 )
14681500 b := New (200 )
Original file line number Diff line number Diff line change @@ -10,31 +10,27 @@ func popcntSlice(s []uint64) (cnt uint64) {
1010}
1111
1212func popcntMaskSlice (s , m []uint64 ) (cnt uint64 ) {
13- _ = m [len (s )- 1 ] // BCE
1413 for i := range s {
1514 cnt += uint64 (bits .OnesCount64 (s [i ] &^ m [i ]))
1615 }
1716 return
1817}
1918
2019func popcntAndSlice (s , m []uint64 ) (cnt uint64 ) {
21- _ = m [len (s )- 1 ] // BCE
2220 for i := range s {
2321 cnt += uint64 (bits .OnesCount64 (s [i ] & m [i ]))
2422 }
2523 return
2624}
2725
2826func popcntOrSlice (s , m []uint64 ) (cnt uint64 ) {
29- _ = m [len (s )- 1 ] // BCE
3027 for i := range s {
3128 cnt += uint64 (bits .OnesCount64 (s [i ] | m [i ]))
3229 }
3330 return
3431}
3532
3633func popcntXorSlice (s , m []uint64 ) (cnt uint64 ) {
37- _ = m [len (s )- 1 ] // BCE
3834 for i := range s {
3935 cnt += uint64 (bits .OnesCount64 (s [i ] ^ m [i ]))
4036 }
You can’t perform that action at this time.
0 commit comments