Commit ab44e32a authored by celinemercier's avatar celinemercier

More efficient obi_column_set_int() and obi_column_get_int()

parent 41f62709
......@@ -27,19 +27,15 @@
int obi_column_set_int(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obiint_t value)
{
// check if can write?
size_t nb_elements_per_line = -1;
nb_elements_per_line = (column->header)->nb_elements_per_line;
*(((obiint_t*) (column->data)) + (line_nb * nb_elements_per_line) + element_idx) = value;
// when/where check if can write?
*(((obiint_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value;
return 0;
}
obiint_t obi_column_get_int(OBIDMS_column_p column, size_t line_nb, size_t element_idx)
{
size_t nb_elements_per_line = -1;
nb_elements_per_line = (column->header)->nb_elements_per_line;
return *(((obiint_t*) (column->data)) + (line_nb * nb_elements_per_line) + element_idx);
return *(((obiint_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx);
}
......
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