Alignment in allocator question

Carlos Rafael Giani dv at pseudoterminal.org
Mon Mar 3 13:47:28 PST 2014


Hello,

I noticed thus line inside gstallocator.c :

g_return_val_if_fail (((params->align + 1) & params->align) == 0, NULL);

and also read up again that align is actually a bitmask.

My question is: why? This seems unnecessarily complicated and forced. If 
alignment is not a power of 2, this will fail. Plus, specifying 
alignment this way is quite unusual. If I want to align memory to 
16-byte boundaries, I have to specify 15. I do not see the rationale 
behind this design decision.


More information about the gstreamer-devel mailing list