Home | History | Annotate | Download | only in EfiCommonLib
      1 /*++
      2 
      3 Copyright (c) 2004, 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 Module Name:
     13 
     14   EfiSetMem.c
     15 
     16 Abstract:
     17 
     18   Implementation of the EfiSetMem routine. This function is broken
     19   out into its own source file so that it can be excluded from a
     20   build for a particular platform easily if an optimized version
     21   is desired.
     22 
     23 --*/
     24 
     25 #include "Tiano.h"
     26 #include "EfiCommonLib.h"
     27 
     28 
     29 VOID
     30 EfiCommonLibSetMem (
     31   IN VOID   *Buffer,
     32   IN UINTN  Size,
     33   IN UINT8  Value
     34   )
     35 /*++
     36 
     37 Routine Description:
     38 
     39   Set Buffer to Value for Size bytes.
     40 
     41 Arguments:
     42 
     43   Buffer  - Memory to set.
     44 
     45   Size    - Number of bytes to set
     46 
     47   Value   - Value of the set operation.
     48 
     49 Returns:
     50 
     51   None
     52 
     53 --*/
     54 {
     55   INT8  *Ptr;
     56 
     57   if (Value == 0) {
     58     EfiCommonLibZeroMem (Buffer, Size);
     59   } else {
     60     Ptr = Buffer;
     61     while (Size--) {
     62       *(Ptr++) = Value;
     63     }
     64   }
     65 }
     66