which bits are set
    Paul N. Hilfinger 
    hilfingr at rama.cs.cornell.edu
       
    Wed Dec 19 05:37:52 AEST 1990
    
    
  
In article <1990Dec18.093905.17196 at kithrup.COM> sef at kithrup.COM (Sean Eric Fagan) writes:
>Well, let's see.  The problem was to convert something like
>
>	0x12345678
>
>into something like
>
>	bit_set[0] = 0;
>	bit_set[1] = 0;
>	bit_set[2] = 0;
>	bit_set[3] = 1;
Well, no it wasn't.  The original problem was to convert 0x12345678
into something like
	bit_set[0] = 3;
	bit_set[1] = 4;
	bit_set[2] = 5;
	bit_set[3] = 6;
	bit_set[4] = 9;
	...
	bit_set[15] = -1;   /* Excuse me if my counting is off. */
for which I suspect Mr. Bernstein's proposed solution sketch is
probably pretty good.
P. Hilfinger
    
    
More information about the Comp.lang.c
mailing list