>> operator

S

sieg1974

Hi,

I came accross this command line "#define PIDHASH_SZ (4096 >> 2)", but
I didn't find any information about the >> operator. Could anyway give
me a brief explanation?

Thanks,

Andre
 
R

Richard Heathfield

sieg1974 said:
Hi,

I came accross this command line "#define PIDHASH_SZ (4096 >> 2)", but
I didn't find any information about the >> operator. Could anyway give
me a brief explanation?

Right-shift.

4096 >> 2 is equal to 1024

Think bits. If we take 16 bit ints (for brevity):

4096 is 00010000 00000000

Right shift once:

00001000 00000000 (That's 2048)

Right shift again:

00000100 00000000 (That's 1024)
 
M

Martin Ambuhl

sieg1974 said:
Hi,

I came accross this command line "#define PIDHASH_SZ (4096 >> 2)", but
I didn't find any information about the >> operator. Could anyway give
me a brief explanation?

'>>' is the right shift operator
(4096 >> 2) is 4096 shifted right two bits, or 1024.
One suspects that 4096 or 2 or both were symbolic constants in some earlier
form of the code.
 

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
474,125
Messages
2,570,748
Members
47,302
Latest member
MitziWragg

Latest Threads

Top