Thread: _rotl

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    14

    _rotl

    in C++ theres _rotl and _rotr is there an equivalent method for those in c#?

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    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

Popular pages Recent additions subscribe to a feed