shift question

H

horvatj

Hi there!

I have a very silly shift operation question:

My test code does something like this:
int j=1;
int y=0;
int i=0;
int bs=0;

for(i=0;i<16;i++){
bs=1<<j;
y=?????;
printf("%i:\tj=%i\tbs=%i\t\ty=%i\n", i, j, bs, y);
j++;
}

I want y to be the bit set in bs=1<<j - I know usally done by y=j...

But in my real application I have a bs=1024 or bs=512 and have to
determine the y
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,631
Members
45,338
Latest member
41Pearline46

Latest Threads

Top