Commit a613733d authored by NICOLAS DENOYELLE's avatar NICOLAS DENOYELLE

Merge branch 'master' into code_split

parents d477ab0e 52f9a76c
......@@ -15,7 +15,7 @@ static void circular_fifo_add(struct circular_fifo_s *fifo, ssize_t elem)
}
static void circular_fifo_dump(const struct circular_fifo_s *fifo,
ssize_t * vals)
ssize_t *vals)
{
ssize_t i;
ssize_t j;
......@@ -73,7 +73,7 @@ static int cons_it_copy(excit_t ddst, const excit_t dsrc)
return EXCIT_SUCCESS;
}
static int cons_it_size(const excit_t data, ssize_t * size)
static int cons_it_size(const excit_t data, ssize_t *size)
{
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
ssize_t tmp_size = 0;
......@@ -85,7 +85,7 @@ static int cons_it_size(const excit_t data, ssize_t * size)
return EXCIT_SUCCESS;
}
static int cons_it_split(const excit_t data, ssize_t n, excit_t * results)
static int cons_it_split(const excit_t data, ssize_t n, excit_t *results)
{
ssize_t size;
int err = cons_it_size(data, &size);
......@@ -136,7 +136,7 @@ error1:
return err;
}
static int cons_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
static int cons_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
{
ssize_t size;
int err = cons_it_size(data, &size);
......@@ -158,8 +158,8 @@ static int cons_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
return EXCIT_SUCCESS;
}
static int cons_it_rank(const excit_t data, const ssize_t * indexes,
ssize_t * n)
static int cons_it_rank(const excit_t data, const ssize_t *indexes,
ssize_t *n)
{
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
ssize_t inner_n, inner_n_tmp;
......@@ -182,7 +182,7 @@ static int cons_it_rank(const excit_t data, const ssize_t * indexes,
return EXCIT_SUCCESS;
}
static int cons_it_pos(const excit_t data, ssize_t * n)
static int cons_it_pos(const excit_t data, ssize_t *n)
{
ssize_t inner_n;
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
......@@ -195,7 +195,7 @@ static int cons_it_pos(const excit_t data, ssize_t * n)
return EXCIT_SUCCESS;
}
static int cons_it_peek(const excit_t data, ssize_t * indexes)
static int cons_it_peek(const excit_t data, ssize_t *indexes)
{
const struct cons_it_s *it = (const struct cons_it_s *)data->data;
int err;
......@@ -212,7 +212,7 @@ static int cons_it_peek(const excit_t data, ssize_t * indexes)
return EXCIT_SUCCESS;
}
static int cons_it_next(excit_t data, ssize_t * indexes)
static int cons_it_next(excit_t data, ssize_t *indexes)
{
struct cons_it_s *it = (struct cons_it_s *)data->data;
int err;
......
......@@ -8,19 +8,19 @@
#include "hilbert2d.h"
#include "range.h"
#define CASE(val) case val: return #val; break;
#define CASE(val) case val: return #val; break
const char *excit_type_name(enum excit_type_e type)
{
switch (type) {
CASE(EXCIT_RANGE)
CASE(EXCIT_CONS)
CASE(EXCIT_REPEAT)
CASE(EXCIT_HILBERT2D)
CASE(EXCIT_PRODUCT)
CASE(EXCIT_SLICE)
CASE(EXCIT_USER)
CASE(EXCIT_TYPE_MAX)
CASE(EXCIT_RANGE);
CASE(EXCIT_CONS);
CASE(EXCIT_REPEAT);
CASE(EXCIT_HILBERT2D);
CASE(EXCIT_PRODUCT);
CASE(EXCIT_SLICE);
CASE(EXCIT_USER);
CASE(EXCIT_TYPE_MAX);
default:
return NULL;
}
......@@ -29,13 +29,13 @@ const char *excit_type_name(enum excit_type_e type)
const char *excit_error_name(enum excit_error_e err)
{
switch (err) {
CASE(EXCIT_SUCCESS)
CASE(EXCIT_STOPIT)
CASE(EXCIT_ENOMEM)
CASE(EXCIT_EINVAL)
CASE(EXCIT_EDOM)
CASE(EXCIT_ENOTSUP)
CASE(EXCIT_ERROR_MAX)
CASE(EXCIT_SUCCESS);
CASE(EXCIT_STOPIT);
CASE(EXCIT_ENOMEM);
CASE(EXCIT_EINVAL);
CASE(EXCIT_EDOM);
CASE(EXCIT_ENOTSUP);
CASE(EXCIT_ERROR_MAX);
default:
return NULL;
}
......@@ -127,7 +127,7 @@ error:
return NULL;
}
excit_t excit_alloc_user(struct excit_func_table_s * func_table,
excit_t excit_alloc_user(struct excit_func_table_s *func_table,
size_t data_size)
{
excit_t it;
......@@ -181,7 +181,7 @@ error:
free(it);
}
int excit_dimension(excit_t it, ssize_t * dimension)
int excit_dimension(excit_t it, ssize_t *dimension)
{
if (!it || !dimension)
return -EXCIT_EINVAL;
......@@ -197,7 +197,7 @@ int excit_type(excit_t it, enum excit_type_e *type)
return EXCIT_SUCCESS;
}
int excit_next(excit_t it, ssize_t * indexes)
int excit_next(excit_t it, ssize_t *indexes)
{
if (!it || !it->func_table)
return -EXCIT_EINVAL;
......@@ -206,7 +206,7 @@ int excit_next(excit_t it, ssize_t * indexes)
return it->func_table->next(it, indexes);
}
int excit_peek(const excit_t it, ssize_t * indexes)
int excit_peek(const excit_t it, ssize_t *indexes)
{
if (!it || !it->func_table)
return -EXCIT_EINVAL;
......@@ -215,7 +215,7 @@ int excit_peek(const excit_t it, ssize_t * indexes)
return it->func_table->peek(it, indexes);
}
int excit_size(const excit_t it, ssize_t * size)
int excit_size(const excit_t it, ssize_t *size)
{
if (!it || !it->func_table || !size)
return -EXCIT_EINVAL;
......@@ -233,7 +233,7 @@ int excit_rewind(excit_t it)
return it->func_table->rewind(it);
}
int excit_split(const excit_t it, ssize_t n, excit_t * results)
int excit_split(const excit_t it, ssize_t n, excit_t *results)
{
if (!it || !it->func_table)
return -EXCIT_EINVAL;
......@@ -244,7 +244,7 @@ int excit_split(const excit_t it, ssize_t n, excit_t * results)
return it->func_table->split(it, n, results);
}
int excit_nth(const excit_t it, ssize_t n, ssize_t * indexes)
int excit_nth(const excit_t it, ssize_t n, ssize_t *indexes)
{
if (!it || !it->func_table)
return -EXCIT_EINVAL;
......@@ -253,7 +253,7 @@ int excit_nth(const excit_t it, ssize_t n, ssize_t * indexes)
return it->func_table->nth(it, n, indexes);
}
int excit_rank(const excit_t it, const ssize_t * indexes, ssize_t * n)
int excit_rank(const excit_t it, const ssize_t *indexes, ssize_t *n)
{
if (!it || !it->func_table || !indexes)
return -EXCIT_EINVAL;
......@@ -262,7 +262,7 @@ int excit_rank(const excit_t it, const ssize_t * indexes, ssize_t * n)
return it->func_table->rank(it, indexes, n);
}
int excit_pos(const excit_t it, ssize_t * n)
int excit_pos(const excit_t it, ssize_t *n)
{
if (!it || !it->func_table)
return -EXCIT_EINVAL;
......@@ -271,7 +271,7 @@ int excit_pos(const excit_t it, ssize_t * n)
return it->func_table->pos(it, n);
}
int excit_cyclic_next(excit_t it, ssize_t * indexes, int *looped)
int excit_cyclic_next(excit_t it, ssize_t *indexes, int *looped)
{
int err;
......
......@@ -256,7 +256,8 @@ int excit_split(const excit_t it, ssize_t n, excit_t * results);
/*
* Gets the nth element of an iterator.
* "it": an iterator.
* "rank": rank of the element, comprised between 0 and the size of the iterator.
* "rank": rank of the element, comprised between 0 and the size of the
* iterator.
* "indexes": an array of indexes with a dimension corresponding to that of the
* iterator, no results is returned if NULL.
* Returns EXCIT_SUCCESS or an error code.
......
#include "dev/excit.h"
#include "hilbert2d.h"
static void rot(ssize_t n, ssize_t * x, ssize_t * y, ssize_t rx, ssize_t ry)
static void rot(ssize_t n, ssize_t *x, ssize_t *y, ssize_t rx, ssize_t ry)
{
if (ry == 0) {
if (rx == 1) {
......@@ -31,7 +31,7 @@ static ssize_t xy2d(ssize_t n, ssize_t x, ssize_t y)
}
//convert d to (x,y)
static void d2xy(ssize_t n, ssize_t d, ssize_t * x, ssize_t * y)
static void d2xy(ssize_t n, ssize_t d, ssize_t *x, ssize_t *y)
{
ssize_t rx, ry, s, t = d;
......@@ -85,7 +85,7 @@ static int hilbert2d_it_rewind(excit_t data)
return excit_rewind(it->range_it);
}
static int hilbert2d_it_peek(const excit_t data, ssize_t * val)
static int hilbert2d_it_peek(const excit_t data, ssize_t *val)
{
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
ssize_t d;
......@@ -99,7 +99,7 @@ static int hilbert2d_it_peek(const excit_t data, ssize_t * val)
return EXCIT_SUCCESS;
}
static int hilbert2d_it_next(excit_t data, ssize_t * val)
static int hilbert2d_it_next(excit_t data, ssize_t *val)
{
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
ssize_t d;
......@@ -112,13 +112,13 @@ static int hilbert2d_it_next(excit_t data, ssize_t * val)
return EXCIT_SUCCESS;
}
static int hilbert2d_it_size(const excit_t data, ssize_t * size)
static int hilbert2d_it_size(const excit_t data, ssize_t *size)
{
const struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
return excit_size(it->range_it, size);
}
static int hilbert2d_it_nth(const excit_t data, ssize_t n, ssize_t * val)
static int hilbert2d_it_nth(const excit_t data, ssize_t n, ssize_t *val)
{
ssize_t d;
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
......@@ -131,8 +131,8 @@ static int hilbert2d_it_nth(const excit_t data, ssize_t n, ssize_t * val)
return EXCIT_SUCCESS;
}
static int hilbert2d_it_rank(const excit_t data, const ssize_t * indexes,
ssize_t * n)
static int hilbert2d_it_rank(const excit_t data, const ssize_t *indexes,
ssize_t *n)
{
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
......@@ -144,14 +144,14 @@ static int hilbert2d_it_rank(const excit_t data, const ssize_t * indexes,
return excit_rank(it->range_it, &d, n);
}
static int hilbert2d_it_pos(const excit_t data, ssize_t * n)
static int hilbert2d_it_pos(const excit_t data, ssize_t *n)
{
struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
return excit_pos(it->range_it, n);
}
static int hilbert2d_it_split(const excit_t data, ssize_t n, excit_t * results)
static int hilbert2d_it_split(const excit_t data, ssize_t n, excit_t *results)
{
const struct hilbert2d_it_s *it = (struct hilbert2d_it_s *)data->data;
int err = excit_split(it->range_it, n, results);
......
......@@ -63,7 +63,7 @@ static int prod_it_rewind(excit_t data)
return EXCIT_SUCCESS;
}
static int prod_it_size(const excit_t data, ssize_t * size)
static int prod_it_size(const excit_t data, ssize_t *size)
{
const struct prod_it_s *it = (const struct prod_it_s *)data->data;
ssize_t tmp_size = 0;
......@@ -87,7 +87,7 @@ static int prod_it_size(const excit_t data, ssize_t * size)
return EXCIT_SUCCESS;
}
static int prod_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
static int prod_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
{
ssize_t size;
int err = prod_it_size(data, &size);
......@@ -117,8 +117,8 @@ static int prod_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
return EXCIT_SUCCESS;
}
static int prod_it_rank(const excit_t data, const ssize_t * indexes,
ssize_t * n)
static int prod_it_rank(const excit_t data, const ssize_t *indexes,
ssize_t *n)
{
const struct prod_it_s *it = (const struct prod_it_s *)data->data;
......@@ -145,7 +145,7 @@ static int prod_it_rank(const excit_t data, const ssize_t * indexes,
return EXCIT_SUCCESS;
}
static int prod_it_pos(const excit_t data, ssize_t * n)
static int prod_it_pos(const excit_t data, ssize_t *n)
{
const struct prod_it_s *it = (const struct prod_it_s *)data->data;
......@@ -171,7 +171,7 @@ static int prod_it_pos(const excit_t data, ssize_t * n)
return EXCIT_SUCCESS;
}
static inline int prod_it_peeknext_helper(excit_t data, ssize_t * indexes,
static inline int prod_it_peeknext_helper(excit_t data, ssize_t *indexes,
int next)
{
struct prod_it_s *it = (struct prod_it_s *)data->data;
......@@ -212,17 +212,17 @@ static inline int prod_it_peeknext_helper(excit_t data, ssize_t * indexes,
return EXCIT_SUCCESS;
}
static int prod_it_peek(const excit_t data, ssize_t * indexes)
static int prod_it_peek(const excit_t data, ssize_t *indexes)
{
return prod_it_peeknext_helper(data, indexes, 0);
}
static int prod_it_next(excit_t data, ssize_t * indexes)
static int prod_it_next(excit_t data, ssize_t *indexes)
{
return prod_it_peeknext_helper(data, indexes, 1);
}
static int prod_it_split(const excit_t data, ssize_t n, excit_t * results)
static int prod_it_split(const excit_t data, ssize_t n, excit_t *results)
{
ssize_t size;
int err = prod_it_size(data, &size);
......@@ -271,7 +271,7 @@ error1:
return err;
}
int excit_product_count(const excit_t it, ssize_t * count)
int excit_product_count(const excit_t it, ssize_t *count)
{
if (!it || it->type != EXCIT_PRODUCT || !count)
return -EXCIT_EINVAL;
......@@ -280,7 +280,7 @@ int excit_product_count(const excit_t it, ssize_t * count)
}
int excit_product_split_dim(const excit_t it, ssize_t dim, ssize_t n,
excit_t * results)
excit_t *results)
{
if (!it || it->type != EXCIT_PRODUCT)
return -EXCIT_EINVAL;
......
......@@ -36,7 +36,7 @@ static int range_it_rewind(excit_t data)
return EXCIT_SUCCESS;
}
static int range_it_peek(const excit_t data, ssize_t * val)
static int range_it_peek(const excit_t data, ssize_t *val)
{
struct range_it_s *it = (struct range_it_s *)data->data;
......@@ -53,7 +53,7 @@ static int range_it_peek(const excit_t data, ssize_t * val)
return EXCIT_SUCCESS;
}
static int range_it_next(excit_t data, ssize_t * val)
static int range_it_next(excit_t data, ssize_t *val)
{
struct range_it_s *it = (struct range_it_s *)data->data;
int err = range_it_peek(data, val);
......@@ -64,7 +64,7 @@ static int range_it_next(excit_t data, ssize_t * val)
return EXCIT_SUCCESS;
}
static int range_it_size(const excit_t data, ssize_t * size)
static int range_it_size(const excit_t data, ssize_t *size)
{
const struct range_it_s *it = (struct range_it_s *)data->data;
......@@ -83,7 +83,7 @@ static int range_it_size(const excit_t data, ssize_t * size)
return EXCIT_SUCCESS;
}
static int range_it_nth(const excit_t data, ssize_t n, ssize_t * val)
static int range_it_nth(const excit_t data, ssize_t n, ssize_t *val)
{
ssize_t size;
int err = range_it_size(data, &size);
......@@ -99,7 +99,7 @@ static int range_it_nth(const excit_t data, ssize_t n, ssize_t * val)
return EXCIT_SUCCESS;
}
static int range_it_rank(const excit_t data, const ssize_t * val, ssize_t * n)
static int range_it_rank(const excit_t data, const ssize_t *val, ssize_t *n)
{
ssize_t size;
int err = range_it_size(data, &size);
......@@ -116,7 +116,7 @@ static int range_it_rank(const excit_t data, const ssize_t * val, ssize_t * n)
return EXCIT_SUCCESS;
}
static int range_it_pos(const excit_t data, ssize_t * n)
static int range_it_pos(const excit_t data, ssize_t *n)
{
ssize_t val;
int err = range_it_peek(data, &val);
......@@ -130,7 +130,7 @@ static int range_it_pos(const excit_t data, ssize_t * n)
return EXCIT_SUCCESS;
}
static int range_it_split(const excit_t data, ssize_t n, excit_t * results)
static int range_it_split(const excit_t data, ssize_t n, excit_t *results)
{
const struct range_it_s *it = (struct range_it_s *)data->data;
ssize_t size;
......
......@@ -32,14 +32,14 @@ static int repeat_it_copy(excit_t ddst, const excit_t dsrc)
return EXCIT_SUCCESS;
}
static int repeat_it_peek(const excit_t data, ssize_t * indexes)
static int repeat_it_peek(const excit_t data, ssize_t *indexes)
{
const struct repeat_it_s *it = (const struct repeat_it_s *)data->data;
return excit_peek(it->it, indexes);
}
static int repeat_it_next(excit_t data, ssize_t * indexes)
static int repeat_it_next(excit_t data, ssize_t *indexes)
{
struct repeat_it_s *it = (struct repeat_it_s *)data->data;
......@@ -50,7 +50,7 @@ static int repeat_it_next(excit_t data, ssize_t * indexes)
return excit_next(it->it, indexes);
}
static int repeat_it_size(const excit_t data, ssize_t * size)
static int repeat_it_size(const excit_t data, ssize_t *size)
{
const struct repeat_it_s *it = (const struct repeat_it_s *)data->data;
int err = excit_size(it->it, size);
......@@ -69,7 +69,7 @@ static int repeat_it_rewind(excit_t data)
return excit_rewind(it->it);
}
static int repeat_it_nth(const excit_t data, ssize_t n, ssize_t * val)
static int repeat_it_nth(const excit_t data, ssize_t n, ssize_t *val)
{
ssize_t size;
int err = repeat_it_size(data, &size);
......@@ -83,7 +83,7 @@ static int repeat_it_nth(const excit_t data, ssize_t n, ssize_t * val)
return excit_nth(it->it, n / it->n, val);
}
static int repeat_it_pos(const excit_t data, ssize_t * n)
static int repeat_it_pos(const excit_t data, ssize_t *n)
{
ssize_t inner_n;
const struct repeat_it_s *it = (const struct repeat_it_s *)data->data;
......@@ -96,7 +96,7 @@ static int repeat_it_pos(const excit_t data, ssize_t * n)
return EXCIT_SUCCESS;
}
static int repeat_it_split(const excit_t data, ssize_t n, excit_t * results)
static int repeat_it_split(const excit_t data, ssize_t n, excit_t *results)
{
const struct repeat_it_s *it = (const struct repeat_it_s *)data->data;
int err = excit_split(it->it, n, results);
......
......@@ -35,7 +35,7 @@ static int slice_it_copy(excit_t dst, const excit_t src)
return EXCIT_SUCCESS;
}
static int slice_it_next(excit_t data, ssize_t * indexes)
static int slice_it_next(excit_t data, ssize_t *indexes)
{
struct slice_it_s *it = (struct slice_it_s *)data->data;
ssize_t n;
......@@ -46,7 +46,7 @@ static int slice_it_next(excit_t data, ssize_t * indexes)
return excit_nth(it->src, n, indexes);
}
static int slice_it_peek(const excit_t data, ssize_t * indexes)
static int slice_it_peek(const excit_t data, ssize_t *indexes)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
ssize_t n;
......@@ -57,7 +57,7 @@ static int slice_it_peek(const excit_t data, ssize_t * indexes)
return excit_nth(it->src, n, indexes);
}
static int slice_it_size(const excit_t data, ssize_t * size)
static int slice_it_size(const excit_t data, ssize_t *size)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
......@@ -71,7 +71,7 @@ static int slice_it_rewind(excit_t data)
return excit_rewind(it->indexer);
}
static int slice_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
static int slice_it_nth(const excit_t data, ssize_t n, ssize_t *indexes)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
ssize_t p;
......@@ -82,8 +82,8 @@ static int slice_it_nth(const excit_t data, ssize_t n, ssize_t * indexes)
return excit_nth(it->src, p, indexes);
}
static int slice_it_rank(const excit_t data, const ssize_t * indexes,
ssize_t * n)
static int slice_it_rank(const excit_t data, const ssize_t *indexes,
ssize_t *n)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
ssize_t inner_n;
......@@ -94,14 +94,14 @@ static int slice_it_rank(const excit_t data, const ssize_t * indexes,
return excit_rank(it->indexer, &inner_n, n);
}
static int slice_it_pos(const excit_t data, ssize_t * n)
static int slice_it_pos(const excit_t data, ssize_t *n)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
return excit_pos(it->indexer, n);
}
static int slice_it_split(const excit_t data, ssize_t n, excit_t * results)
static int slice_it_split(const excit_t data, ssize_t n, excit_t *results)
{
const struct slice_it_s *it = (const struct slice_it_s *)data->data;
int err = excit_split(it->indexer, n, results);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment