function w = bitsll(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);
else
    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', 'BITSLL');
    end
    if isfloat(u)
        % Using EML_LDEXP avoids extra generated saturation code.
        % Also, note that EML_LDEXP only handles REAL SCALAR inputs.
        w = coder.nullcopy(u);
        for idx = 1:numel(u)
            if isreal(u)
                w(idx) = eml_ldexp(u(idx), v);
            else
                wRe    = eml_ldexp(real(u(idx)), v);
                wIm    = eml_ldexp(imag(u(idx)), v);
                w(idx) = complex(wRe, wIm);
            end
        end
    elseif isinteger(u)
        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', 'bitsll', class(u));
        end
        w  = storedInteger(bitsll(temp, v));
    else
        eml_invariant(false, 'fixed:bitsxx:invalidDataType', 'bitsll', class(u));
        w = 0;
    end
end
