"I am a person who works hard and plays hard."

Yuan Wei
Second Year Graduate Student Department of Computer Science
University of Virginia Charlottesville, VA 22903
Email: yw3f@cs.virginia.edu


Source Code Analysis

Main Page   Compound List   File List   Compound Members   File Members  

endian.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

Enumerations

Functions


Define Documentation

#define SWAP_HALF      (((((half_t)(X)) & 0xff) << 8) | ((((half_t)(X)) & 0xff00) >> 8))
 

Definition at line 86 of file endian.h.

#define SWAP_QWORD  
 

Value:

(((qword_t)(X) << 56) |                         \
                         (((qword_t)(X) << 40) & ULL(0x00ff000000000000)) |\
                         (((qword_t)(X) << 24) & ULL(0x0000ff0000000000)) |\
                         (((qword_t)(X) << 8)  & ULL(0x000000ff00000000)) |\
                         (((qword_t)(X) >> 8)  & ULL(0x00000000ff000000)) |\
                         (((qword_t)(X) >> 24) & ULL(0x0000000000ff0000)) |\
                         (((qword_t)(X) >> 40) & ULL(0x000000000000ff00)) |\
                         (((qword_t)(X) >> 56) & ULL(0x00000000000000ff)))

Definition at line 92 of file endian.h.

#define SWAP_WORD  
 

Value:

(((word_t)(X) << 24) |                          \
                         (((word_t)(X) << 8)  & 0x00ff0000) |           \
                         (((word_t)(X) >> 8)  & 0x0000ff00) |           \
                         (((word_t)(X) >> 24) & 0x000000ff))

Definition at line 88 of file endian.h.


Enumeration Type Documentation

enum endian_t
 

Enumeration values:
endian_big 
endian_little 
endian_unknown 

Definition at line 102 of file endian.h.


Function Documentation

enum endian_t endian_host_byte_order void   
 

Definition at line 81 of file endian.c.

References endian_big, endian_little, and endian_unknown.

Referenced by eio_create(), eio_open(), ld_load_prog(), and main().

00082 {
00083   int i = 1, *p;
00084 
00085   p = &i;
00086   if (*((char *)p) == 1)
00087     return endian_little;
00088   else if (*((char *)p) == 0)
00089     return endian_big;
00090   else
00091     return endian_unknown;
00092 }

enum endian_t endian_host_word_order void   
 

Definition at line 96 of file endian.c.

References endian_big, endian_little, and endian_unknown.

Referenced by ld_load_prog(), and main().

00097 {
00098   int *p;
00099   double x = 1.0;
00100 
00101   /* NOTE: this check assumes IEEE floating point format */
00102   p = (int *)&x;
00103   if (*p == 0)
00104     return endian_little;
00105   else if (*p == 0x3ff00000)
00106     return endian_big;
00107   else
00108     return endian_unknown;
00109 }

enum endian_t endian_target_byte_order void   
 

Definition at line 116 of file endian.c.

References endian_big, and endian_little.

Referenced by endian_target_word_order(), and ld_load_prog().

00117 {
00118   return ld_target_big_endian ? endian_big : endian_little;
00119 }

enum endian_t endian_target_word_order void   
 

Definition at line 124 of file endian.c.

References endian_target_byte_order().

Referenced by ld_load_prog().

00125 {
00126   /* same as byte sex for SimpleScalar target */
00127   return endian_target_byte_order();
00128 }



UVa CS Department of Computer Science
School of Engineering, University of Virginia
151 Engineer's Way, P.O. Box 400740
Charlottesville, Virginia 22904-4740

(434) 982-2200  Fax: (434) 982-2214