_rotl

This is a discussion on _rotl within the C# Programming forums, part of the General Programming Boards category; in C++ theres _rotl and _rotr is there an equivalent method for those in c#?...

  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

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