]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLib/SetMem.c
Update copyright for files modified in this year
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLib / SetMem.c
CommitLineData
e1f414b6 1/** @file\r
2 Implementation of the EfiSetMem routine. This function is broken\r
3 out into its own source file so that it can be excluded from a\r
4 build for a particular platform easily if an optimized version\r
5 is desired.\r
6\r
373ade0e 7 Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
e1f414b6 8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
e1f414b6 16**/\r
17\r
1efcc4ae 18\r
f734a10a 19\r
e1f414b6 20\r
21#include "MemLibInternals.h"\r
22\r
23/**\r
24 Set Buffer to Value for Size bytes.\r
25\r
efb23117 26 @param Buffer Memory to set.\r
27 @param Length Number of bytes to set\r
28 @param Value Value of the set operation.\r
e1f414b6 29\r
30 @return Buffer\r
31\r
32**/\r
33VOID *\r
34EFIAPI\r
35InternalMemSetMem (\r
36 IN VOID *Buffer,\r
0827d304 37 IN UINTN Length,\r
e1f414b6 38 IN UINT8 Value\r
39 )\r
40{\r
41 //\r
42 // Declare the local variables that actually move the data elements as\r
43 // volatile to prevent the optimizer from replacing this function with\r
44 // the intrinsic memset()\r
45 //\r
46 volatile UINT8 *Pointer;\r
47\r
48 Pointer = (UINT8*)Buffer;\r
5d7ceba3 49 while (Length-- != 0) {\r
e1f414b6 50 *(Pointer++) = Value;\r
51 }\r
52 return Buffer;\r
53}\r