_rotl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to use the _rotl function or if there an equivalent in C#

Tanks for your hel
 
Gilles said:
Does anyone know how to use the _rotl function or if there
an equivalent in C# ?

Anything wrong with using the left shift operator?

int x = y << z;
 
The shift operation replaces the shifted bits by 0
What I would like is that the shifted bit goes to the right of the byte

Any idea

Thank

Gilles
 
Gilles said:
The shift operation replaces the shifted bits by 0.
What I would like is that the shifted bit goes to the right of the byte.

Any idea ?

Ah, I see. Sorry! Well, you could do:

public static uint RotateLeft (uint original, int bits)
{
return (original << bits) | (original >> (32-bits));
}

Does that help?
 
public static uint RotateLeft (uint original, int bits)
{
return (original << bits) | (original >> (32-bits));
}


nice one... only I was 28 seconds faster... :))
 
Back
Top