#include "CanStructs.h"

uint32_t CanId::serialize() const
{
	uint32_t id = 0;
	id |= destination;
	id |= source << 8;
	id |= address << 16;
	id |= type << 27;
	return id;
}

void CanId::deserialize(uint32_t id)
{
	destination = id & 0xFF;
	source = (id >> 8) & 0xFF;
	address = (id >> 16) & 0x7FF;
	type = (id >> 27) & 0x2;
}
