Skip to content

Commit

Permalink
- Added boolean array fill function
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9552 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jul 29, 2011
1 parent a75415c commit 77883d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions c_runtime/boolean_array.c
Expand Up @@ -863,3 +863,20 @@ void convert_alloc_boolean_array_from_f77(boolean_array_t* a,
}
transpose_boolean_array(a, dest);
}

/* Fills an array with a value. */
void fill_alloc_boolean_array(boolean_array_t* dest, modelica_boolean value, int ndims, ...)
{
size_t i;
size_t elements = 0;
va_list ap;
va_start(ap, ndims);
elements = alloc_base_array(dest, ndims, ap);
va_end(ap);
dest->data = integer_alloc(elements);

for(i = 0; i < elements; ++i)
{
boolean_set(dest, i, value);
}
}
1 change: 1 addition & 0 deletions c_runtime/boolean_array.h
Expand Up @@ -185,5 +185,6 @@ void convert_alloc_boolean_array_to_f77(boolean_array_t* a,
boolean_array_t* dest);
void convert_alloc_boolean_array_from_f77(boolean_array_t* a,
boolean_array_t* dest);
void fill_alloc_boolean_array(boolean_array_t* dest, modelica_boolean value, int ndims, ...);

#endif

0 comments on commit 77883d1

Please sign in to comment.