anchor.diff:          _ ->
               undefined
       end.
  +
  +-spec estimate_keys(hashtree()) -> {ok, integer()}.
  +estimate_keys(State) ->
  +    estimate_keys(State, 0, 0, ?NUM_KEYS_REQUIRED).
  +
  +estimate_keys(_State, ?MAX_NUM_SEGMENTS, Keys, _MaxKeys) ->
  +    {ok, Keys*(?NUM_SEGMENTS div ?MAX_NUM_SEGMENTS)};
  +
  +estimate_keys(_State, CurrentSegment, Keys, MaxKeys) when Keys >= MaxKeys ->
  +    {ok, (Keys * ?NUM_SEGMENTS) div (CurrentSegment + 1)};
  +
  +estimate_keys(State, CurrentSegment, Keys, MaxKeys) ->
  +    [{_, KeyHashes2}] = key_hashes(State, CurrentSegment),
  +    estimate_keys(State, CurrentSegment + 1, Keys + length(KeyHashes2), MaxKeys).
   
   -spec key_hashes(hashtree(), integer()) -> [{integer(), orddict()}].
   key_hashes(State, Segment) ->
  
positive.code: -define(WIDTH, 1024).
  -define(MEM_LEVELS, 0).
  
  -type tree_id_bin() :: <<_:176>>.
  -type segment_bin() :: <<_:256, _:_*8>>.
  -type bucket_bin()  :: <<_:320>>.
  
negative.code:          new/3,
           insert/3,
           insert/4,
           estimate_keys/1,
           delete/2,
           update_tree/1,
           update_snapshot/1,
  