File: porting.h

package info (click to toggle)
swath 0.3.0.cvs20030404
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,564 kB
  • ctags: 545
  • sloc: sh: 6,926; cpp: 3,643; makefile: 151
file content (29 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// porting.h - definition of classes for code porting
// Created: 12 Jul 1996
// Author:  Theppitak Karoonboonyanan
//

#ifndef PORTING_INC
#define PORTING_INC

#include "misc/typedefs.h"

//
// IsHighEndianSystem() -  indicates if the running system is using
//    high-endian storage method,that is, high byte of an integer is
//    stored at low address.
//
// For example, an 2-byte integer of value 0xff00 will be stored in:
//    Low-Endian:  00 FF
//    High-Endian: FF 00
//
bool IsHighEndianSystem();

// Convertors between Low-Endian and High-Endian systems
uint16 ReverseBytes16(uint16 n);
uint32 ReverseBytes32(uint32 n);

inline uint16 ReverseBytes16(uint16 n)  { return (n<<8) | (n>>8); }

#endif  // PORTING_INC