anchor.diff:           from_binary/2,
            to_binary/1,
            is_member/2,
  -         insert/2]).
  +         insert/2,
  +         intersection/2]).
   
   -record(pieceset, {
       size :: pos_integer(),
  
positive.code:             NewElements = Elements bor piecemask(PieceIndex, Size),
              Pieceset#pieceset{elements=NewElements}
      end.
      
  
  piecemask(PieceIndex, Size) ->
  
negative.code:     ?assert(?set:is_member(0, Set)),
      ?assertEqual(<<1:1, 0:3, 1:1, 0:3>>, ?set:to_binary(Set)).
  
  intersection_size_test() ->
      Set0 = ?set:new(5),
      Set1 = ?set:new(6),
      ?assertError(badarg, ?set:intersection(Set0, Set1)).
  
  intersection_test() ->
      Set0  = ?set:from_binary(<<1:1, 0:7,      1:1, 0:7>>, 16),
      Set1  = ?set:from_binary(<<1:1, 1:1, 0:6, 1:1, 0:7>>, 16),
      Inter = ?set:intersection(Set0, Set1),
      Bitfield = <<1:1, 0:1, 0:6, 1:1, 0:7>>,
      ?assertEqual(Bitfield, ?set:to_binary(Inter)).
  
  
  %%
  %% Conversion from piecesets to bitfields should produce valid bitfields.
  %%
  