VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/StdLib/LibC/Main/ByteSwap.c@ 50283

Last change on this file since 50283 was 48674, checked in by vboxsync, 11 years ago

EFI: Export newly imported tinaocore UEFI sources to OSE.

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/** @file
2 Byte Swap routines for endian-nes conversions.
3
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12**/
13#include <Library/BaseLib.h>
14#include <LibConfig.h>
15
16#include <sys/bswap.h>
17
18// Undefine macro versions of the functions to be defined below.
19#undef bswap16
20#undef bswap32
21#undef bswap64
22
23/**
24Switches the endianness of a 16-bit integer.
25
26This function swaps the bytes in a 16-bit unsigned value to switch the value
27from little endian to big endian or vice versa. The byte swapped value is
28returned.
29
30@param Value A 16-bit unsigned value.
31
32@return The byte swapped Value.
33
34**/
35uint16_t bswap16(uint16_t Value)
36{
37 return SwapBytes16(Value);
38}
39
40/**
41Switches the endianness of a 32-bit integer.
42
43This function swaps the bytes in a 32-bit unsigned value to switch the value
44from little endian to big endian or vice versa. The byte swapped value is
45returned.
46
47@param Value A 32-bit unsigned value.
48
49@return The byte swapped Value.
50
51**/
52uint32_t bswap32(uint32_t Value)
53{
54 return SwapBytes32(Value);
55}
56
57/**
58Switches the endianness of a 64-bit integer.
59
60This function swaps the bytes in a 64-bit unsigned value to switch the value
61from little endian to big endian or vice versa. The byte swapped value is
62returned.
63
64@param Value A 64-bit unsigned value.
65
66@return The byte swapped Value.
67
68**/
69uint64_t bswap64(uint64_t Value)
70{
71 return SwapBytes64(Value);
72}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette