#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_INTEGER_8)
-extern void count_8_l16 (gfc_array_i8 *, gfc_array_l16 *, index_type *);
+extern void count_8_l16 (gfc_array_i8 * const restrict,
+ gfc_array_l16 * const restrict, const index_type * const restrict);
export_proto(count_8_l16);
void
-count_8_l16 (gfc_array_i8 *retarray, gfc_array_l16 *array, index_type *pdim)
+count_8_l16 (gfc_array_i8 * const restrict retarray,
+ gfc_array_l16 * const restrict array,
+ const index_type * const restrict pdim)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
index_type sstride[GFC_MAX_DIMENSIONS];
index_type dstride[GFC_MAX_DIMENSIONS];
- GFC_LOGICAL_16 *base;
- GFC_INTEGER_8 *dest;
+ const GFC_LOGICAL_16 * restrict base;
+ GFC_INTEGER_8 * restrict dest;
index_type rank;
index_type n;
index_type len;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
- /* TODO: It should be a front end job to correctly set the strides. */
-
- if (array->dim[0].stride == 0)
- array->dim[0].stride = 1;
-
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
delta = array->dim[dim].stride;
}
else
{
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
-
if (rank != GFC_DESCRIPTOR_RANK (retarray))
runtime_error ("rank of return array incorrect");
}
while (base)
{
- GFC_LOGICAL_16 *src;
+ const GFC_LOGICAL_16 * restrict src;
GFC_INTEGER_8 result;
src = base;
{
the next dimension. */
count[n] = 0;
/* We could precalculate these products, but this is a less
- frequently used path so proabably not worth it. */
+ frequently used path so probably not worth it. */
base -= sstride[n] * extent[n];
dest -= dstride[n] * extent[n];
n++;