www.pudn.com > SerialGPS.zip > sizeof.m, change:2002-12-10,size:876b


function s = sizeof(type) 
% SIZEOF Number of bytes in a given precision specification 
 
persistent typemap initialized 
 
% Set up the type map if we haven't already done so 
if (isempty(initialized)) 
    initialized = 1; 
     
    % Char types 
    typemap.uchar   = 1; 
    typemap.char    = 1; 
    typemap.schar   = 1; 
     
    % Integer types 
    typemap.int8    = 1; 
    typemap.int16   = 2; 
    typemap.int32   = 4; 
    typemap.short   = 2; 
    typemap.int     = 4; 
    typemap.long    = 4; 
     
    typemap.uint8    = 1; 
    typemap.uint16   = 2; 
    typemap.uint32   = 4; 
    typemap.ushort   = 2; 
    typemap.uint     = 4; 
    typemap.ulong    = 4; 
     
    % Floating point types 
    typemap.single   = 4; 
    typemap.float32  = 4; 
    typemap.float    = 4; 
    typemap.double   = 8; 
    typemap.float64  = 8; 
end 
 
s = typemap.(type);