Avoid double copy of mcv in emu_ev

This commit is contained in:
Rodrigo Arias 2023-02-23 19:07:43 +01:00 committed by Rodrigo Arias Mallo
parent c55a92872b
commit e907474ea9
2 changed files with 12 additions and 7 deletions

View File

@ -7,9 +7,9 @@ void
emu_ev(struct emu_ev *ev, const struct ovni_ev *oev,
int64_t sclock, int64_t dclock)
{
ev->mcv[0] = ev->m = oev->header.model;
ev->mcv[1] = ev->c = oev->header.category;
ev->mcv[2] = ev->v = oev->header.value;
ev->m = oev->header.model;
ev->c = oev->header.category;
ev->v = oev->header.value;
ev->mcv[3] = '\0';
ev->rclock = oev->header.clock;

View File

@ -9,10 +9,15 @@
/* Easier to parse emulation event */
struct emu_ev {
union {
struct {
uint8_t m;
uint8_t c;
uint8_t v;
uint8_t nil;
};
char mcv[4];
};
int64_t rclock; /* As-is clock in the binary stream */
int64_t sclock; /* Corrected clock with stream offset */