"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.c File Reference

#include "endian.h"
#include "loader.h"

Include dependency graph for endian.c:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Functions


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