Main Page   Compound List   File List   Compound Members   File Members  

translate.cc File Reference

#include "copyright.h"
#include "machine.h"
#include "addrspace.h"
#include "system.h"

Go to the source code of this file.

Functions

unsigned int WordToHost (unsigned int word)
unsigned short ShortToHost (unsigned short shortword)
unsigned int WordToMachine (unsigned int word)
unsigned short ShortToMachine (unsigned short shortword)


Function Documentation

unsigned short ShortToHost unsigned short    shortword
 

Definition at line 56 of file translate.cc.

Referenced by main, Machine::ReadMem, and ShortToMachine.

00056                                       {
00057 #ifdef HOST_IS_BIG_ENDIAN
00058          register unsigned short result;
00059          result = (shortword << 8) & 0xff00;
00060          result |= (shortword >> 8) & 0x00ff;
00061          return result;
00062 #else 
00063          return shortword;
00064 #endif /* HOST_IS_BIG_ENDIAN */
00065 }

unsigned short ShortToMachine unsigned short    shortword
 

Definition at line 71 of file translate.cc.

References ShortToHost.

Referenced by Machine::WriteMem.

00071 { return ShortToHost(shortword); }

unsigned int WordToHost unsigned int    word
 

Definition at line 42 of file translate.cc.

Referenced by AddrSpace::AddrSpace, main, Machine::ReadMem, SwapHeader, and WordToMachine.

00042                               {
00043 #ifdef HOST_IS_BIG_ENDIAN
00044          register unsigned long result;
00045          result = (word >> 24) & 0x000000ff;
00046          result |= (word >> 8) & 0x0000ff00;
00047          result |= (word << 8) & 0x00ff0000;
00048          result |= (word << 24) & 0xff000000;
00049          return result;
00050 #else 
00051          return word;
00052 #endif /* HOST_IS_BIG_ENDIAN */
00053 }

unsigned int WordToMachine unsigned int    word
 

Definition at line 68 of file translate.cc.

References WordToHost.

Referenced by Machine::WriteMem.

00068 { return WordToHost(word); }


Generated on Mon Feb 10 09:54:53 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees