anchor.diff:  %% Bitwise ops
   types(erlang, 'band', [_,_]=Args) ->
       sub_unsafe(erlang_band_type(Args), [#t_integer{}, #t_integer{}]);
  -types(erlang, 'bor', [_,_]) ->
  -    sub_unsafe(#t_integer{}, [#t_integer{}, #t_integer{}]);
  +types(erlang, 'bor', [_,_]=Args) ->
  +    sub_unsafe(erlang_bor_type(Args), [#t_integer{}, #t_integer{}]);
   types(erlang, 'bxor', [_,_]) ->
       sub_unsafe(#t_integer{}, [#t_integer{}, #t_integer{}]);
   types(erlang, 'bsl', [_,_]) ->
       sub_unsafe(#t_integer{}, [#t_integer{}, #t_integer{}]);
  -types(erlang, 'bsr', [_,_]) ->
  -    sub_unsafe(#t_integer{}, [#t_integer{}, #t_integer{}]);
  +types(erlang, 'bsr', [_,_]=Types) ->
  +    ArgTypes = [#t_integer{}, #t_integer{}],
  +    case Types of
  +        [#t_integer{elements={Min,Max}},#t_integer{elements={S,S}}] when S > 0 ->
  +            T = #t_integer{elements={Min bsr S,Max bsr S}},
  +            sub_unsafe(T, ArgTypes);
  +        _ ->
  +            sub_unsafe(#t_integer{}, ArgTypes)
  +    end;
   types(erlang, 'bnot', [_]) ->
       sub_unsafe(#t_integer{}, [#t_integer{}]);
   
  
positive.code: %% Note that these are all from the erlang module; suitable functions in other
  %% modules could fail due to the module not being loaded.
  types(erlang, 'map_size', [_]) ->
      sub_safe(#t_integer{}, [#t_map{}]);
  types(erlang, 'tuple_size', [_]) ->
      sub_safe(#t_integer{}, [#t_tuple{}]);
  types(erlang, 'bit_size', [_]) ->
      sub_safe(#t_integer{}, [#t_bitstring{}]);
  types(erlang, 'byte_size', [_]) ->
      sub_safe(#t_integer{}, [#t_bitstring{}]);
  types(erlang, hd, [Src]) ->
      RetType = erlang_hd_type(Src),
      sub_safe(RetType, [#t_cons{}]);
  
negative.code: types(erlang, 'not', [_]) ->
      Bool = beam_types:make_boolean(),
      sub_safe(Bool, [Bool]);
  types(erlang, 'length', [Src]) ->
      Min = case Src of
                #t_cons{} -> 1;
                _ -> 0
            end,
      sub_safe(#t_integer{elements={Min,?SIZE_UPPER_LIMIT}}, [proper_list()]);
  
  %% Boolean ops
  types(erlang, 'and', [_,_]) ->
  