Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

>> ?

Status
Not open for further replies.

lieip

Programmer
Oct 2, 2001
12
US
I'm trying to to translate a C hash function into VBA. But I'm a bit rusty on my C. What does << >> means? I thought it was only used in cin and cout.

Here:
h += (h<<10);

What does this << mean and how would I convert that to VBA?

TIA
 
>What does this << mean and how would I convert that to VBA?

Bit shift left -- multiply by 1024 (2 to the 10th).
 
n<<x means shift the bits x times the left. Effectly creating a number that is 2 to the x power times bigger -- unless you run into overflow or your using signed integers.

n>>x means shift the bits x time to the right. Effectly deviding by 2 to the power x. Again, be aware that it shifts in zeros, so if you're using a signed int you can get odd results (negitive numbers become positive).

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top