anchor.diff:  %% negative or larger than the size of this piece set, this
   %% function exists with the reason badarg.
   %% @end
  --spec insert(pos_integer(), pieceset()) -> pieceset().
  +-spec insert(non_neg_integer(), pieceset()) -> pieceset().
   insert(PieceIndex, _) when PieceIndex < 0 ->
       error(badarg);
   insert(PieceIndex, Pieceset) ->
  
positive.code: %% Create an empty set of piece indexes. The set of pieces
  %% is limited to contain pieces indexes from 0 to Size-1.
  %% @end
  -spec new(pos_integer()) -> pieceset().
  new(Size) ->
      PaddingLen = paddinglen(Size),
      Elements = <<0:Size, 0:PaddingLen>>,
  
negative.code: %% Convert a piece set to an ordered list of the piece indexes
  %% that are members of this set.
  %% @end
  -spec to_list(pieceset()) -> list(non_neg_integer()).
  to_list(Pieceset) ->
      #pieceset{elements=Elements} = Pieceset,
      to_list(Elements, 0).
  