Alignment in allocator question

Wim Taymans wim.taymans at gmail.com
Tue Mar 4 03:40:46 PST 2014


It's a bitmask and it checks ((align&(align+1))==0). The reason for the
bitmask is that it is easy to combine alignments, you can just or them
together to get the max required alignment.

Wim


On 4 March 2014 12:23, Carlos Rafael Giani <dv at pseudoterminal.org> wrote:

>  On 2014-03-04 03:54, Nicolas Dufresne wrote:
>
> Le lundi 03 mars 2014 à 22:47 +0100, Carlos Rafael Giani a écrit :
>
> and also read up again that align is actually a bitmask.
>
>
> I didn't check the code you are referring, but alignment is usually a
> shift, not a mask.
>
> Nicolas
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> Well yes. Inside the code, the align value is used for both the allocation
> size and the shifting of the pointer, as usual. The odd thing is that the
> documentation describes it as a bitmask, and the code tests that it is a
> power of two (with the (align&(align-1))==0 check). This is what I find so
> strange. Why this complicated solution? Why not just a plain alignment
> value?
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140304/691e5a1f/attachment.html>


More information about the gstreamer-devel mailing list