Home | History | Annotate | Download | only in BaseLib
      1 /*++
      2 
      3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 
     13 Module Name:
     14 
     15   LRotU32.c
     16 
     17 Abstract:
     18 
     19   Math worker functions.
     20 
     21 --*/
     22 
     23 #include "BaseLibInternals.h"
     24 
     25 /**
     26   Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
     27   with the high bits that were rotated.
     28 
     29   This function rotates the 32-bit value Operand to the left by Count bits. The
     30   low Count bits are fill with the high Count bits of Operand. The rotated
     31   value is returned.
     32 
     33   If Count is greater than 31, then ASSERT().
     34 
     35   @param  Operand The 32-bit operand to rotate left.
     36   @param  Count   The number of bits to rotate left.
     37 
     38   @return Operand <<< Count
     39 
     40 **/
     41 UINT32
     42 EFIAPI
     43 LRotU32 (
     44   IN      UINT32                    Operand,
     45   IN      UINTN                     Count
     46   )
     47 {
     48   ASSERT (Count < sizeof (Operand) * 8);
     49   return (Operand << Count) | (Operand >> (32 - Count));
     50 }
     51