Re: [AD] signed/unsigned issue ? geta32()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


aj wrote:


32bit ARGB 8888 .. how can it work.. what happens to the MSB (bit 31)

allegro docs:
int geta32(int c);

signed/unsigned issue ?


No issue.  The code is:

AL_INLINE(int, geta32, (int c),
{
  return ((c >> _rgb_a_shift_32) & 0xFF);
})

Let c = 0xfe123456, _rgb_a_shift_32 = 24.
(c >> _rgb_a_shift_32) = 0xfffffffe (assuming sign extension)
0xfffffffe & 0xFF = 0xfe

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/