anchor.diff:      {Value + Offset, Rem};
   decode_internal(Bin, enumeration, _Name, {Tag, States}, Spec) ->
       {Index, Rem} = decode_tag(Bin, Tag, Spec),
  -    {Value, Index} = lists:keyfind(Index, 2, States),
  +    {Value, Index} = case lists:keyfind(Index, 2, States) of
  +                         false ->
  +                             throw({out_of_range_enumeration_value, _Name, Index});
  +                         R -> R
  +                     end,
       {Value, Rem};
   decode_internal(Bin, record, _Name, InstFields, Spec) ->
       {FinalBin, Vals} = lists:foldl(fun({data, FieldName, _, RefName}, {FoldBin, Acc}) ->
  
positive.code: 
  encode_int({instance, union, Name, {FieldName, Value}}, Spec) when is_atom(FieldName) ->
      {descriptor, union, Name, {Tag, Fields}} = lookup_type(Name, union, Spec),
      {data, FieldName, Index, RefName} = lists:keyfind(FieldName, 2, Fields),
      {descriptor, Prototype, RefName, _Desc} = lookup_type(RefName, Spec),
      [encode_int({instance, primitive, tag_to_prim(Tag), Index}, Spec),
       encode_int({instance, Prototype, RefName, Value}, Spec)];
  
  encode_int({instance, union, Name, FieldName}, Spec) when is_atom(FieldName) ->
      {descriptor, union, Name, {Tag, Fields}} = lookup_type(Name, union, Spec),
      {empty, FieldName, Index} = lists:keyfind(FieldName, 2, Fields),
      [encode_int({instance, primitive, tag_to_prim(Tag), Index}, Spec)];
  
  encode_int({instance, combination, Name, InstFields}, Spec) ->
  
negative.code:     end.
  
  encode(TypeName, Value, Spec) ->
      {descriptor, Prototype, Name, _Desc} = lookup_type(TypeName, Spec),
      encode_int({instance, Prototype, Name, Value}, Spec).
  
  encode_int({instance, primitive, u8, Value}, _Spec) ->
  