/* Works for both CAN and FDCAN DLC values. */
uint8_t fdcan_dlc_to_length(uint32_t dlc)
/* Works for both CAN and FDCAN DLC values. */
uint8_t fdcan_dlc_to_length(uint32_t dlc)
{
	if (dlc <= 8) {
		return dlc;
	} else if (dlc <= 12) {
		return 8 + ((dlc - 8) * 4);
	} else {
		return 16 + ((dlc - 12) * 16);
	}
}