]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | Math worker functions.\r | |
3 | \r | |
bb817c56 | 4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e1f414b6 | 6 | \r |
7 | **/\r | |
8 | \r | |
e1f414b6 | 9 | #include "BaseLibInternals.h"\r |
10 | \r | |
11 | /**\r | |
12 | Switches the endianess of a 32-bit integer.\r | |
13 | \r | |
14 | This function swaps the bytes in a 32-bit unsigned value to switch the value\r | |
15 | from little endian to big endian or vice versa. The byte swapped value is\r | |
16 | returned.\r | |
17 | \r | |
2fc60b70 | 18 | @param Value A 32-bit unsigned value.\r |
e1f414b6 | 19 | \r |
2fc60b70 | 20 | @return The byte swapped Value.\r |
e1f414b6 | 21 | \r |
22 | **/\r | |
23 | UINT32\r | |
24 | EFIAPI\r | |
25 | SwapBytes32 (\r | |
2f88bd3a | 26 | IN UINT32 Value\r |
e1f414b6 | 27 | )\r |
28 | {\r | |
29 | UINT32 LowerBytes;\r | |
30 | UINT32 HigherBytes;\r | |
31 | \r | |
2f88bd3a MK |
32 | LowerBytes = (UINT32)SwapBytes16 ((UINT16)Value);\r |
33 | HigherBytes = (UINT32)SwapBytes16 ((UINT16)(Value >> 16));\r | |
e1f414b6 | 34 | \r |
35 | return (LowerBytes << 16 | HigherBytes);\r | |
36 | }\r |