dol: fix shm_t contain the shm-buffers
[jump.git] / minidol / lib / index.c
1 /* index.c: some index calculations */
2
3 #include <stdint.h>
4
5 #include "e_lib.h"
6
7 /* some defines */
8 #define CORE0           0x808   /* coreid of first core */
9 #define CORES_PER_ROW   4       /* cores per row - 4 on E16G3 */
10
11 uint32_t core_id2lin(e_coreid_t coreid)
12 {       /* take coreid, return linear index */
13         return((coreid-CORE0) / (64/CORES_PER_ROW) + (coreid-CORE0)%64);
14 }
15
16 uint32_t core_lin2id(uint32_t eidx)
17 {       /* take linear index, return coreid */
18         return(64 * eidx / CORES_PER_ROW + eidx % CORES_PER_ROW + CORE0);
19 }
20