Further "flatten" the DRAM layout's declaration for sample data. Declare
timestamps and sample data as uint16_t, keep accessing them via endianess
aware conversion routines. Accessing a larger integer in smaller quantities
is perfectly fine, the inverse direction would be problematic.
*/
static uint16_t sigma_dram_cluster_ts(struct sigma_dram_cluster *cluster)
{
- return read_u16le(&cluster->timestamp[0]);
+ return read_u16le((const uint8_t *)&cluster->timestamp);
}
/*
*/
static uint16_t sigma_dram_cluster_data(struct sigma_dram_cluster *cl, int idx)
{
- return read_u16le(&cl->samples[idx].sample[0]);
+ return read_u16le((const uint8_t *)&cl->samples[idx]);
}
/*
struct sigma_dram_line {
struct sigma_dram_cluster {
- uint8_t timestamp[sizeof(uint16_t)];
- struct sigma_dram_event {
- uint8_t sample[sizeof(uint16_t)];
- } samples[EVENTS_PER_CLUSTER];
+ uint16_t timestamp;
+ uint16_t samples[EVENTS_PER_CLUSTER];
} cluster[CLUSTERS_PER_ROW];
};