%#codegen
function y = fi_div_by_shift(a, shift_len) 
coder.inline('always'); 
if isfi(a)
 nt = numerictype(a);
 fm = fimath(a);
 nt_bs = numerictype(nt.Signed, nt.WordLength+shift_len, nt.FractionLength+shift_len);
 y = bitsra(fi(a, nt_bs, fm), shift_len);
else
    y = a / 2 ^ shift_len;
end

end
