I got a lot of memory pieces in 512 bits. I need to write numbers in 20 bits.
For example:
// a piece of 512 bits memory
void *p = malloc(64);
struct Coords {
int20_t x, y;
};
// usage
Coords *pcoord = (Coords *)p;
for (int i = 0; i < 512 / 40/*sizeof(Coords)*/; ++i) {
pcoord[i].x = i;
pcoord[i].y = 2 * i;
}
How to implement int20_t ?
I need exactly 20 bits for an integer. The numbers must be continuous. ( [0] to [19] for the first Coords.x; [20] to [39] for the first Coords.y; ... There are 12 pairs of Coords with 480 bits and 32 bits for the pad.)
Aucun commentaire:
Enregistrer un commentaire