2016-09-16 11:42:33 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define NB_ELEMENTS(x) (sizeof(x)/ sizeof(x[0]))
|
|
|
|
|
|
|
|
#define STRINGIFY(x) #x
|
|
|
|
#define TOSTRING(x) STRINGIFY(x)
|
2016-09-28 14:08:43 +02:00
|
|
|
|
2017-01-01 23:35:19 +01:00
|
|
|
#define findIndex(x,y) findIdx(x, y, NB_ELEMENTS((y)))
|
|
|
|
|
|
|
|
int findIdx(int el, const int array[], uint size){
|
|
|
|
for (uint i = 0; i < size; i++) {
|
2016-09-28 14:08:43 +02:00
|
|
|
if (el == array[i])
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|