Rotates the bits to the right. - CSharp System

CSharp examples for System:Bit

Description

Rotates the bits to the right.

Demo Code


using System;/*from  www  . j av  a2s. co m*/

public class Main{
        /// <summary>
      /// Rotates the bits to the right.
      /// </summary>
      /// <param name="value">The value to rotate.</param>
      /// <param name="count">The number of bits to rotate.</param>
      /// <returns>The value rotated by <paramref name="count"/> to the right.</returns>
      public static int RotateRight(int value, int count) => ((value >> (count & 0x1f)) | (value << ((0x20 - count) & 0x1f)));
}

Related Tutorials