/src/hbfa-fl/HBFA/UefiHostTestPkg/Library/BaseLibHost/SwapBytes16.c
Line | Count | Source |
1 | | /** @file |
2 | | Math worker functions. |
3 | | |
4 | | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> |
5 | | SPDX-License-Identifier: BSD-2-Clause-Patent |
6 | | |
7 | | **/ |
8 | | |
9 | | #include <Base.h> |
10 | | #include <Library/BaseLib.h> |
11 | | |
12 | | /** |
13 | | Switches the endianess of a 16-bit integer. |
14 | | |
15 | | This function swaps the bytes in a 16-bit unsigned value to switch the value |
16 | | from little endian to big endian or vice versa. The byte swapped value is |
17 | | returned. |
18 | | |
19 | | @param Value A 16-bit unsigned value. |
20 | | |
21 | | @return The byte swapped Value. |
22 | | |
23 | | **/ |
24 | | UINT16 |
25 | | EFIAPI |
26 | | SwapBytes16 ( |
27 | | IN UINT16 Value |
28 | | ) |
29 | 3.48k | { |
30 | 3.48k | return (UINT16) ((Value<< 8) | (Value>> 8)); |
31 | 3.48k | } |