anchor.diff:  
   %% userdevguide-begin rt_frtchord:get_replica_keys
   %% @doc Returns the replicas of the given key.
  --spec get_replica_keys(key()) -> [key()].
   get_replica_keys(Key) ->
       [Key,
        Key bxor 16#40000000000000000000000000000000,
  
positive.code: 
  %% userdevguide-begin rt_frtchord:types
  -type key_t() :: 0..16#FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF. % 128 bit numbers
  -type rt_t() :: Succ::node:node_type().
  -type external_rt_t() :: Succ::node:node_type().
  -type custom_message() :: {get_rt, SourcePID :: comm:mypid()}.
  
  % define the possible types of nodes in the routing table:
  %  - normal nodes are nodes which have been added by entry learning
  %  - source is the node at which this RT is
  %  - sticky is a node which is not to be deleted with entry filtering
  -type node_type() :: 'normal' | 'source' | 'sticky'.
  -record(rt_entry, {
          node :: rt_t()
          , type :: node_type()
          , spacing = 0.0 :: float() % canonical space around a node
          , adjacent_fingers = {undefined, undefined} :: {rt_t() | 'undefined',
                                                          rt_t() | 'undefined'}
  
      }).
  
  -opaque(rt_entry() :: #rt_entry{}).
  %% userdevguide-end rt_frtchord:types
  
  % Note: must include rt_beh.hrl AFTER the type definitions for erlang < R13B04
  % to work.
  -include("rt_beh.hrl").
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Key Handling
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  %% userdevguide-begin rt_frtchord:empty
  %% @doc Creates an "empty" routing table containing the successor.
  -spec empty(nodelist:neighborhood()) -> rt().
  empty(Neighbors) -> 
      % enter all known nodes as sticky entries into the gb tree
      EmptyRT = gb_trees:empty(),
      Preds = nodelist:preds(Neighbors),
      Succs = nodelist:succs(Neighbors),
      PredsAdded = lists:foldl(fun add_sticky_entry/2, EmptyRT, Preds),
      SuccsAndPredsAdded = lists:foldl(fun add_sticky_entry/2, PredsAdded, Succs),
      add_source_entry(nodelist:node(Neighbors), SuccsAndPredsAdded)
      .
  %% userdevguide-end rt_frtchord:empty
  
  % @doc Initialize the routing table. This function is allowed to send messages.
  -spec init(nodelist:neighborhood()) -> rt().
  init(Neighbors) -> 
      % ask the successor node for its routing table
      % XXX i have to wrap the message as the Pid given as the succ is actually the dht
  
negative.code: %% userdevguide-begin rt_frtchord:filter_dead_node
  %% @doc Removes dead nodes from the routing table (rely on periodic
  %%      stabilization here).
  filter_dead_node(RT, DeadPid) -> 
      % find the node id of DeadPid and delete it from the RT
      [Node] = [N || {N, _,_,_} <- to_list(RT), node:pidX(N) =:= DeadPid],
      entry_delete(node:id(Node), RT)
      .
  %% userdevguide-end rt_frtchord:filter_dead_node
  
  %% userdevguide-begin rt_frtchord:to_pid_list
  %% @doc Returns the pids of the routing table entries.
  %% TODO RT should probably be a State tuple, not the RT itself
  to_pid_list(RT) -> [node:pidX(rt_entry_node(N)) || N <- to_list(RT)].
  %% userdevguide-end rt_frtchord:to_pid_list
  
  %% userdevguide-begin rt_frtchord:get_size
  %% @doc Returns the size of the routing table.
  get_size(RT) -> gb_trees:size(get_rt_tree(RT)).
  %% userdevguide-end rt_frtchord:get_size
  
  %% userdevguide-begin rt_frtchord:n
  %% @doc Returns the size of the address space.
  n() -> n_().
  %% @doc Helper for n/0 to make dialyzer happy with internal use of n/0.
  n_() -> 16#FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 1.
  %% userdevguide-end rt_frtchord:n
  
  %% @doc Keep a key in the address space. See n/0.
  normalize(Key) -> Key band 16#FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.
  
  %% @doc Gets the number of keys in the interval (Begin, End]. In the special
  %%      case of Begin==End, the whole key range as specified by n/0 is returned.
  get_range(Begin, End) -> get_range_(Begin, End).
  
  %% @doc Helper for get_range/2 to make dialyzer happy with internal use of
  %%      get_range/2 in the other methods, e.g. get_split_key/3.
  get_range_(Begin, Begin) -> n_(); % I am the only node
  get_range_(?MINUS_INFINITY, ?PLUS_INFINITY) -> n_(); % special case, only node
  get_range_(Begin, End) when End > Begin -> End - Begin;
  