Extract bits from int

Discussion created by spectral on Jun 22, 2011
Latest reply on Jun 22, 2011 by spectral


I'm working on a radix-sort algorithm and I need to extract some bits from int values.

My sort is working fine when I sort on 4,12,20,24,28,32 bits but not on 8 and 16 bits !!!!

I don't understand the reason, maybe a problem with the way I extract the bits !

I use the following :


#define EXTRACT_BIT(VALUE,BIT) ((((uint)VALUE)>>BIT)&0x1)

#define EXTRACT_4BITS(VALUE,BIT) ((((uint)VALUE)>>BIT)&0x0F)

Do you have an advice ?