C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-04-2009, 12:52 PM   #1
Registered User
 
Join Date: Nov 2009
Posts: 10
_rotl

in C++ theres _rotl and _rotr is there an equivalent method for those in c#?
deathkosui is offline   Reply With Quote
Old 11-04-2009, 03:18 PM   #2
Registered User
 
valaris's Avatar
 
Join Date: Jun 2008
Location: RING 0
Posts: 462
Code:
public static uint RotateLeft(this uint value, int count)
{
    return (value << count) | (value >> (32 - count))
}

public static uint RotateLeft(this uint value, int count)
{
    return (value >> count) | (value << (32 - count))
}
Credit: C# bitwise rotate left and rotate right - Stack Overflow
valaris is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 11:04 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22