function w = bitsrl(u, v)
% MATLAB Code Generation Library function.

%   Copyright 2002-2014 The MathWorks, Inc.
%#codegen

if eml_ambiguous_types
    if isscalar(u)
        w = coder.ignoreConst(reshape(zeros(size(v)),size(v)));
    else
        w = coder.ignoreConst(reshape(zeros(size(u)),size(u)));
    end
    w = eml_guessdouble(w);
elseif isinteger(u)
    coder.internal.prefer_const(v);
    if eml_is_const(v)
        eml_invariant((isnumeric(v) && isscalar(v) && isequal(floor(v), v) && (v >= 0)), ...
            'fixed:bitsxx:invalidShiftVal', 'BITSRL');
    end
    switch class(u)
        case {'int8','int16','int32','int64','uint8','uint16','uint32','uint64'}
            T = numerictype(class(u));
            temp = eml_fimathislocal(eml_cast(u,T,fimath),0);
        otherwise
            eml_invariant(false, 'fixed:bitsxx:invalidDataType', 'bitsrl', class(u));
    end
    w  = storedInteger(bitsrl(temp, v));
else
    eml_invariant(false, 'fixed:bitsxx:invalidDataType', 'bitsrl', class(u));
    w = 0;
end
