]>
Commit | Line | Data |
---|---|---|
878ddf1f | 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 | |
7 | Copyright (c) 2006, Intel Corporation<BR>\r | |
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 | |
24e25d11 | 16 | Module Name: SetMem.c\r |
878ddf1f | 17 | \r |
18 | **/\r | |
19 | \r | |
58251024 | 20 | #include "MemLibInternals.h"\r |
878ddf1f | 21 | \r |
22 | /**\r | |
23 | Set Buffer to Value for Size bytes.\r | |
24 | \r | |
25 | @param Buffer Memory to set.\r | |
26 | @param Size Number of bytes to set\r | |
27 | @param Value Value of the set operation.\r | |
28 | \r | |
29 | @return Buffer\r | |
30 | \r | |
31 | **/\r | |
32 | VOID *\r | |
33 | EFIAPI\r | |
34 | InternalMemSetMem (\r | |
35 | IN VOID *Buffer,\r | |
36 | IN UINTN Size,\r | |
37 | IN UINT8 Value\r | |
38 | )\r | |
39 | {\r | |
40 | //\r | |
41 | // Declare the local variables that actually move the data elements as\r | |
42 | // volatile to prevent the optimizer from replacing this function with\r | |
43 | // the intrinsic memset()\r | |
44 | //\r | |
45 | volatile UINT8 *Pointer;\r | |
46 | \r | |
47 | Pointer = (UINT8*)Buffer;\r | |
48 | while (Size-- != 0) {\r | |
49 | *(Pointer++) = Value;\r | |
50 | }\r | |
51 | return Buffer;\r | |
52 | }\r |