Forum Discussion
Altera_Forum
Honored Contributor
20 years agoThanks, this gives a good example. The problem you ran into is just one of several alignment issues. I don't think your structure was packed, so you only had to deal with the basic alignment between the buffer and the struct. You probably know that if you printed the address of each struct member, there would be some obvious padding.
In my filesystem, every field of every record will need to be packed for size efficiency, and there are lots of different types of records with different field sizes. Because of this I suspect half the non-byte types will end up unaligned, and so require unaligned access methods. I'd sure like to find out I am wrong. I am trying to determine if it is better to operate on a non-packed record and only pack/unpack on the actual write/read, or operate on the data directly.