Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
sfendian.h
Package: rtsp-1.0.1.tar.gz [view]
Upload User: sy_wanhua
Upload Date: 2013-07-25
Package Size: 3048k
Code Size: 2k
Category:
Streaming_Mpeg4
Development Platform:
C/C++
- /*
- ** Copyright (C) 1999-2000 Erik de Castro Lopo <erikd@zip.com.au>
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU Lesser General Public License as published by
- ** the Free Software Foundation; either version 2.1 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU Lesser General Public License for more details.
- **
- ** You should have received a copy of the GNU Lesser General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
- #include "config.h"
- #if HAVE_ENDIAN_H
- /* This is the best way to do it. Unfortunately Sparc Solaris (and
- ** possibly others) don't have <endian.h>
- */
- #include <endian.h>
- #if (__BYTE_ORDER == __LITTLE_ENDIAN)
- #define CPU_IS_LITTLE_ENDIAN 1
- #define CPU_IS_BIG_ENDIAN 0
- #elif (__BYTE_ORDER == __BIG_ENDIAN)
- #define CPU_IS_LITTLE_ENDIAN 0
- #define CPU_IS_BIG_ENDIAN 1
- #else
- #error "A bit confused about endian-ness! Have <endian.h> but not __BYTEORDER."
- #endif
- #else
- /* If we don't have <endian.h> use the guess based on target processor
- ** from the autoconf process.
- */
- #if GUESS_LITTLE_ENDIAN
- #define CPU_IS_LITTLE_ENDIAN 1
- #define CPU_IS_BIG_ENDIAN 0
- #elif GUESS_BIG_ENDIAN
- #define CPU_IS_LITTLE_ENDIAN 0
- #define CPU_IS_BIG_ENDIAN 1
- #else
- #error "Endian guess seems incorrect."
- #endif
- #endif
- #define ENDSWAP_SHORT(x) ((((x)>>8)&0xFF)|(((x)&0xFF)<<8))
- #define ENDSWAP_INT(x) ((((x)>>24)&0xFF)|(((x)>>8)&0xFF00)|(((x)&0xFF00)<<8)|(((x)&0xFF)<<24))
- #if (CPU_IS_LITTLE_ENDIAN == 1)
- #define H2LE_SHORT(x) (x)
- #define H2LE_INT(x) (x)
- #define LE2H_SHORT(x) (x)
- #define LE2H_INT(x) (x)
- #define BE2H_INT(x) ENDSWAP_INT(x)
- #define BE2H_SHORT(x) ENDSWAP_SHORT(x)
- #define H2BE_INT(x) ENDSWAP_INT(x)
- #define H2BE_SHORT(x) ENDSWAP_SHORT(x)
- #elif (CPU_IS_BIG_ENDIAN == 1)
- #define H2LE_SHORT(x) ENDSWAP_SHORT(x)
- #define H2LE_INT(x) ENDSWAP_INT(x)
- #define LE2H_SHORT(x) ENDSWAP_SHORT(x)
- #define LE2H_INT(x) ENDSWAP_INT(x)
- #define BE2H_INT(x) (x)
- #define BE2H_SHORT(x) (x)
- #define H2BE_INT(x) (x)
- #define H2BE_SHORT(x) (x)
- #else
- #error "Cannot determine endian-ness of processor."
- #endif