Skip to content

Commit

Permalink
Added impl. for Integers.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@911 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Jan 29, 2003
1 parent 024bbe0 commit 13f4b0e
Show file tree
Hide file tree
Showing 6 changed files with 1,473 additions and 32 deletions.
20 changes: 20 additions & 0 deletions c_runtime/index_spec.c
Expand Up @@ -101,3 +101,23 @@ int* make_index_array(int nridx,...)
return res;

}

int imax(int i,int j)
{
return i < j ? j : i;
}

int next_index(int ndims, size_t* idx, size_t* size)
{
int d = ndims - 1;

idx[d]++;
while (idx[d] >= size[d])
{
idx[d] = 0;
if (!d) { return 1; }
d--;
idx[d]++;
}
return 0;
}
4 changes: 4 additions & 0 deletions c_runtime/index_spec.h
Expand Up @@ -22,6 +22,7 @@

#ifndef INDEX_SPEC_H_
#define INDEX_SPEC_H_
#include <stdio.h>

struct index_spec_s
{
Expand All @@ -36,4 +37,7 @@ int index_spec_ok(index_spec_t* s);
void alloc_index_spec(index_spec_t* s);
void create_index_spec(index_spec_t* dest, int nridx, ...);
int* make_index_array(int nridx,...);
int imax(int i,int j);
int next_index(int ndims, size_t* idx, size_t* size);

#endif

0 comments on commit 13f4b0e

Please sign in to comment.