]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Network/PxeBc/Dxe/hton.h
1. Make SPD editor tables bigger.and table now focus the entry added.
[mirror_edk2.git] / EdkModulePkg / Universal / Network / PxeBc / Dxe / hton.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module name:
13 hton.h
14
15 Abstract:
16 Byte swapping macros.
17
18 --*/
19
20 #ifndef _HTON_H_
21 #define _HTON_H_
22
23 //
24 // Only Intel order functions are defined at this time.
25 //
26 #define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
27
28 #define HTONL(v) \
29 (UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
30
31 #define HTONLL(v) swap64 (v)
32
33 #define U8PTR(na) ((UINT8 *) &(na))
34
35 #define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
36
37 #define NTOHL(ns) \
38 ((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
39
40 #endif /* _HTON_H_ */
41
42 /* EOF - hton.h */