You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
980 B
C++
36 lines
980 B
C++
#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位浮点数的转换,swap是否反转
|
|
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
|