|
|
|
|
|
#ifndef ibmformat_h
|
|
|
|
|
|
#define ibmformat_h
|
|
|
|
|
|
|
|
|
|
|
|
class CIbmFormat
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
static int asInt(const void*);
|
|
|
|
|
|
static short asShort(const void*);
|
|
|
|
|
|
static unsigned short asUnsignedShort(const void*);
|
|
|
|
|
|
static float asFloat(const void*);
|
|
|
|
|
|
|
|
|
|
|
|
static void putInt(int,void*);
|
|
|
|
|
|
static void putShort(short,void*);
|
|
|
|
|
|
static void putUnsignedShort(unsigned short,void*);
|
|
|
|
|
|
static void putFloat(float,void*);
|
|
|
|
|
|
|
|
|
|
|
|
//Fixed point for work station
|
|
|
|
|
|
/* fixed options: 16/16 */
|
|
|
|
|
|
/* 32/32 */
|
|
|
|
|
|
static int putFixedPoint(double db, void* buf, int exp=16, int fract=16);
|
|
|
|
|
|
static double asFixedPoint(const void* buf, int exp=16, int fract=16);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>,swap<61>Ƿ<EFBFBD><C7B7><EFBFBD>ת
|
|
|
|
|
|
float IBM2IEEE(float value,int swap=1);
|
|
|
|
|
|
float IEEE2IBM(float value,int swap=1);
|
|
|
|
|
|
void IBM2IEEE(const void *from, void *to, int len=1, int swap=1);
|
|
|
|
|
|
void IEEE2IBM(const void *from, void *to, int len=1, int swap=1);
|
|
|
|
|
|
|
|
|
|
|
|
static void ReverseString(BYTE* str, int num);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|