Example #1
0
/*
 * How much space will 'nelems' of 'type' take in
 *  external representation (as the values of an attribute)?
 */
static size_t
ncx_len_NC_attrV(nc_type type, size_t nelems)
{
	switch(type) {
	case NC_BYTE:
	case NC_CHAR:
		return ncx_len_char(nelems);
	case NC_SHORT:
		return ncx_len_short(nelems);
	case NC_INT:
		return ncx_len_int(nelems);
	case NC_FLOAT:
		return ncx_len_float(nelems);
	case NC_DOUBLE:
		return ncx_len_double(nelems);
	case NC_UBYTE:
		return ncx_len_ubyte(nelems);
	case NC_USHORT:
		return ncx_len_ushort(nelems);
	case NC_UINT:
		return ncx_len_uint(nelems);
	case NC_INT64:
		return ncx_len_int64(nelems);
	case NC_UINT64:
		return ncx_len_uint64(nelems);
	default:
	        assert("ncx_len_NC_attr bad type" == 0);
	}
	return 0;
}
/*
 * How much space will 'nelems' of 'type' take in
 *  external representation (as the values of an attribute)?
 */
static size_t
ncx_len_NC_attrV(nc_type type, size_t nelems)
{
  switch(type) {
  case NC_BYTE:
  case NC_CHAR:
    return ncx_len_char(nelems);
  case NC_SHORT:
    return ncx_len_short(nelems);
  case NC_INT:
    return ncx_len_int(nelems);
  case NC_FLOAT:
    return ncx_len_float(nelems);
  case NC_DOUBLE:
    return ncx_len_double(nelems);
  case NC_NAT:
    break; /* Some compilers complain if enums are missing from a switch */
  }
  /* default */
  assert("ncx_len_NC_attr bad type" == 0);
  return 0;
}