Main Page | Alphabetical List | Class List | File List | Class 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 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 Machine::ReadMem(), 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 Thu Sep 16 12:33:47 2004 for NachOS by doxygen 1.3.8