Rotates the bits to the left. - CSharp System

CSharp examples for System:Bit

Description

Rotates the bits to the left.

Demo Code


using System;/*  ww w  .j a  v a 2  s. c  om*/

public class Main{
        /// <summary>
      /// Rotates the bits to the left.
      /// </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 left.</returns>
      public static int RotateLeft(int value, int count) => ((value << (count & 0x1f)) | (count >> ((0x20 - count) & 0x1f)));
}

Related Tutorials