chkhostid.c
来自「从磁带机读取地震纪录原始代码,包括地震数据格式,2格式等」· C语言 代码 · 共 49 行
C
49 行
/************************************************
Name: IEEE2IBM
Version: 2.0
Date: 1996.07
Purpose: Convert IEEE floating point numbers
to IBM floating point numbers.
************************************************/
void ieee2ibm (float *fv,int sw,int n)
{
float *rin;
unsigned char *cbuf,exp,tem;
unsigned long *umantis,usignl;
long expl,*mantis;
int i;
rin=fv;
for (i=0;i<n;i++,rin++) {
umantis=(unsigned long*)rin;
cbuf=(unsigned char*)rin;
usignl= *umantis & 0x80000000;
exp=(*umantis>>23);
*umantis=((*umantis) | 0x00800000) & 0x00ffffff;
exp-=126;
if (exp % 4) {
*umantis>>=(4-exp % 4);
exp+=4;
} /* end if */
exp>>=2;
exp+=64;
expl=(long) exp;
expl=(expl << 24) & 0x7f000000;
*umantis=(*umantis) | expl | usignl;
if (sw) {
tem=cbuf[0];cbuf[0]=cbuf[3];cbuf[3]=tem;
tem=cbuf[1];cbuf[1]=cbuf[2];cbuf[2]=tem;
} /* end if (sw) */
} /* end for i */
} /* end ieee2ibm */
void chkhostid(void)
{
long lid;
lid=gethostid();
if (lid!=0x7235c21aL && lid!=0x727359c0L) {
printf("\n Illegal user !\n");
exit(-1);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?