Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

utility.cpp File Reference

#include <iostream.h>
#include <string.h>
#include <algorithm.h>
#include "utility.h"

Include dependency graph for utility.cpp:

Include dependency graph

Go to the source code of this file.

Functions

void inttohex (int num, char *ptc, int len)
ostream & operator<< (ostream &os, bytepack &bp)
istream & operator>> (istream &is, bytepack &bp)


Function Documentation

void inttohex int  num,
char *  ptc,
int  len
 

Definition at line 20 of file utility.cpp.

References j.

Referenced by Bufferfstream.Bufferfstream(), dcfdbfilename(), dcfmbfilename(), dcfsbfilename(), MCFTPid.hex(), mcfdbfilename(), mcfmbfilename(), MCFsbfilename(), and mcfsbfilename().

00020                                              {
00021    const char* hexdigit="0123456789ABCDEF";
00022    char* pttmp=(char*)(&num);
00023    unsigned char c;
00024    int j=0;
00025 
00026    for(int i = 0; i < min( len, int(sizeof(int) ) ); i++ ) {
00027 #ifdef STORM_RS6000_AIX
00028       c=pttmp[ sizeof(int) - len + i ];
00029 #endif
00030 #ifdef STORM_x86_LINUX
00031       c=pttmp[ len - 1 - i ];
00032 #endif
00033 #ifdef STORM_SGI_IRIX
00034       c=pttmp[ sizeof(int) - len + i ];
00035 #endif
00036       ptc[j++] = hexdigit[ int( ( c & 0xF0 ) >> 4 ) ];
00037       ptc[j++] = hexdigit[ int( ( c & 0x0F ) ) ];
00038    }
00039 
00040    ptc[j]='\0';
00041 
00042 }

ostream& operator<< ostream &  os,
bytepack bp
 

Definition at line 236 of file utility.cpp.

References bytepack._pt, bytepack._size, and bytepack.write().

00237 {
00238    bp.write( os );
00239    return os;
00240 }

istream& operator>> istream &  is,
bytepack bp
 

Definition at line 242 of file utility.cpp.

References bytepack._pt, bytepack._size, and bytepack.read().

00242                                                    {
00243    bp.read( is );
00244    return is;
00245 }


Generated on Mon May 31 21:40:39 2004 for SR2k4 Assembler by doxygen 1.3.6