function value = rtwwordlengths(model)
% RTWWORDLENGTHS - returns the word lengths for a given target.
% For example,
%
% value.CharNumBits  = int32(8);
% value.ShortNumBits = int32(16);
% value.IntNumBits   = int32(32);
% value.LongNumBits  = int32(32);
% value.LongLongNumBits   = int32(64);
%
% Example
%   rtwwordlengths('model_name')

% Copyright 1994-2023 The MathWorks, Inc.

if strcmp(get_param(model, 'TargetUnknown'), 'off')
    % Use model param values
    value.CharNumBits       = int32(get_param(model, 'TargetBitPerChar'));
    value.ShortNumBits      = int32(get_param(model, 'TargetBitPerShort'));
    value.IntNumBits        = int32(get_param(model, 'TargetBitPerInt'));
    value.LongNumBits       = int32(get_param(model, 'TargetBitPerLong'));
    value.WordSize          = int32(get_param(model, 'TargetWordSize'));
    value.LongLongNumBits   = int32(get_param(model, 'TargetBitPerLongLong'));
    % Is long-long enabled
    value.LongLongMode      = int32(strcmp(get_param(model, 'TargetLongLongMode'), 'on'));
else
    % Model is pre-R14, use defaults
    value = rtwhostwordlengths();
end

