anchor.diff:      Fun(),
       repeat(Fun, N-1).
   
  -string_to_atom(String) ->
  +string_to_atom_ext(String) ->
       Utf8List = string_to_utf8_list(String),
       Len = length(Utf8List),
  -    TagLen = case Len < 256 of
  -		 true -> [119, Len];
  -		 false -> [118, Len bsr 8, Len band 16#ff]
  -	     end,
  -    binary_to_term(list_to_binary([131, TagLen, Utf8List])).
  +    case Len < 256 of
  +	true ->
  +	    [?SMALL_ATOM_UTF8_EXT, Len | Utf8List];
  +	false ->
  +	    [?ATOM_UTF8_EXT, Len bsr 8, Len band 16#ff | Utf8List]
  +    end.
  +
  +string_to_atom(String) ->
  +    binary_to_term(list_to_binary([?VERSION_MAGIC
  +				   | string_to_atom_ext(String)])).
   
   string_to_utf8_list([]) ->
       [];
  
positive.code: %%
  
  -module(distribution_SUITE).
  -compile(r13).
  
  %% Tests distribution and the tcp driver.
  
  
negative.code: 	  bor ((B2 band 16#3F) bsl 6)
  	  bor (B3 band 16#3F))
       | utf8_list_to_string(Bs)].
  
  mk_pid({NodeName, Creation}, Number, Serial) when is_atom(NodeName) ->
      <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName),
      mk_pid({NodeNameExt, Creation}, Number, Serial);
  mk_pid({NodeNameExt, Creation}, Number, Serial) ->
      case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
  					      ?PID_EXT,
  					      NodeNameExt,
  					      uint32_be(Number),
  					      uint32_be(Serial),
  					      uint8(Creation)])) of
  	Pid when is_pid(Pid) ->
  	    Pid;
  	{'EXIT', {badarg, _}} ->
  	    exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]});
  	Other ->
  	    exit({unexpected_binary_to_term_result, Other})
      end.
  
  mk_port({NodeName, Creation}, Number) when is_atom(NodeName) ->
      <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName),
      mk_port({NodeNameExt, Creation}, Number);
  mk_port({NodeNameExt, Creation}, Number) ->
      case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
  					      ?PORT_EXT,
  					      NodeNameExt,
  					      uint32_be(Number),
  					      uint8(Creation)])) of
  	Port when is_port(Port) ->
  	    Port;
  	{'EXIT', {badarg, _}} ->
  	    exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]});
  	Other ->
  	    exit({unexpected_binary_to_term_result, Other})
      end.
  
  mk_ref({NodeName, Creation}, [Number] = NL) when is_atom(NodeName),
  						 is_integer(Creation),
  						 is_integer(Number) ->
      <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName),
      mk_ref({NodeNameExt, Creation}, NL);
  mk_ref({NodeNameExt, Creation}, [Number]) when is_integer(Creation),
  					       is_integer(Number) ->
      case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
  					      ?REFERENCE_EXT,
  					      NodeNameExt,
  					      uint32_be(Number),
  					      uint8(Creation)])) of
  	Ref when is_reference(Ref) ->
  	    Ref;
  	{'EXIT', {badarg, _}} ->
  	    exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]});
  	Other ->
  	    exit({unexpected_binary_to_term_result, Other})
      end;
  mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName),
  					   is_integer(Creation),
  					   is_list(Numbers) ->
      <<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName),
      mk_ref({NodeNameExt, Creation}, Numbers);
  mk_ref({NodeNameExt, Creation}, Numbers) when is_integer(Creation),
  					      is_list(Numbers) ->
      case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
  					      ?NEW_REFERENCE_EXT,
  					      uint16_be(length(Numbers)),
  					      NodeNameExt,
  					      uint8(Creation),
  					      lists:map(fun (N) ->
  								uint32_be(N)
  							end,
  							Numbers)])) of
  	Ref when is_reference(Ref) ->
  	    Ref;
  	{'EXIT', {badarg, _}} ->
  	    exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]});
  	Other ->
  	    exit({unexpected_binary_to_term_result, Other})
      end.
  
  
  uint32_be(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 32 ->
      [(Uint bsr 24) band 16#ff,
       (Uint bsr 16) band 16#ff,
       (Uint bsr 8) band 16#ff,
       Uint band 16#ff];
  uint32_be(Uint) ->
      exit({badarg, uint32_be, [Uint]}).
  
  
  uint16_be(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 16 ->
      [(Uint bsr 8) band 16#ff,
       Uint band 16#ff];
  uint16_be(Uint) ->
      exit({badarg, uint16_be, [Uint]}).
  
  uint8(Uint) when is_integer(Uint), 0 =< Uint, Uint < 1 bsl 8 ->
      Uint band 16#ff;
  uint8(Uint) ->
      exit({badarg, uint8, [Uint]}).
  