function size=sizeof(type)
% sizeof   return size in bytes of all types
% usage:: size=sizeof(type)

% revision history:
% 08/12/98 Mark D. Shattuck <mds> sizeof.m 
% 09/16/00 added more types
% 09/22/00 even more (used list from fread)


switch(lower(type))
  case {'int8'  'uint8'  'uchar'  'unsigned char'  'schar' 'signed char' 'char'  'integer*1' 'char*1'}
    size = 1;
  case {'int16' 'uint16' 'ushort' 'unsigned short'                       'short' 'integer*2'}
    size = 2;
  case {'int32' 'uint32' 'uint'  'int'  'integer*4' 'float32' 'float' 'single' 'real*4'}
    size = 4;
  case {'int64' 'uint64' 'ulong' 'long' 'integer*8' 'float64'         'double' 'real*8'}
    size = 8;
  otherwise
    size = -99;
end