Does anyone know how to use the _rotl function or if there an equivalent in C# Tanks for your hel
G Guest Mar 30, 2004 #1 Does anyone know how to use the _rotl function or if there an equivalent in C# Tanks for your hel
J Jon Skeet [C# MVP] Mar 30, 2004 #2 Gilles said: Does anyone know how to use the _rotl function or if there an equivalent in C# ? Click to expand... Anything wrong with using the left shift operator? int x = y << z;
Gilles said: Does anyone know how to use the _rotl function or if there an equivalent in C# ? Click to expand... Anything wrong with using the left shift operator? int x = y << z;
G Guest Mar 30, 2004 #3 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
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
J Josip Medved Mar 30, 2004 #4 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. Click to expand... (x << z) | (x >> (32 -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. Click to expand... (x << z) | (x >> (32 -z))
J Jon Skeet [C# MVP] Mar 30, 2004 #5 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 ? Click to expand... 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?
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 ? Click to expand... 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?
J Josip Medved Mar 30, 2004 #6 public static uint RotateLeft (uint original, int bits) { return (original << bits) | (original >> (32-bits)); } Click to expand... nice one... only I was 28 seconds faster... )
public static uint RotateLeft (uint original, int bits) { return (original << bits) | (original >> (32-bits)); } Click to expand... nice one... only I was 28 seconds faster... )