📄 xu_swap.c
字号:
int i;
swap_int_4(&(head->jobid));
swap_int_4(&(head->lino));
swap_int_4(&(head->reno));
swap_short_2(&(head->ntrpr));
swap_short_2(&(head->nart));
swap_u_short_2(&(head->hdt));
swap_u_short_2(&(head->dto));
swap_u_short_2(&(head->hns));
swap_u_short_2(&(head->nso));
swap_short_2(&(head->format));
swap_short_2(&(head->fold));
swap_short_2(&(head->tsort));
swap_short_2(&(head->vscode));
swap_short_2(&(head->hsfs));
swap_short_2(&(head->hsfe));
swap_short_2(&(head->hslen));
swap_short_2(&(head->hstyp));
swap_short_2(&(head->schn));
swap_short_2(&(head->hstas));
swap_short_2(&(head->hstae));
swap_short_2(&(head->htatyp));
swap_short_2(&(head->hcorr));
swap_short_2(&(head->bgrcv));
swap_short_2(&(head->rcvm));
swap_short_2(&(head->mfeet));
swap_short_2(&(head->polyt));
swap_short_2(&(head->vpol));
for(i=0; i<170; i++)
{
swap_short_2(&(head->hunass[i]));
}
}
void swapXSegyhead(XSegyhead * head)
{
swap_int_4(&(head-> tracl));
swap_int_4(&(head-> tracr));
swap_int_4(&(head-> fldr));
swap_int_4(&(head-> tracf));
swap_int_4(&(head-> ep));
swap_int_4(&(head-> cdp));
swap_int_4(&(head-> cdpt));
swap_short_2(&(head-> trid));
swap_short_2(&(head-> nvs));
swap_short_2(&(head-> nhs));
swap_short_2(&(head-> duse));
swap_int_4(&(head-> offset));
swap_int_4(&(head-> gelev));
swap_int_4(&(head-> selev));
swap_int_4(&(head-> sdepth));
swap_int_4(&(head-> gdel));
swap_int_4(&(head-> sdel));
swap_int_4(&(head-> swdep));
swap_int_4(&(head-> gwdep));
swap_short_2(&(head-> scalel));
swap_short_2(&(head-> scalco));
swap_int_4(&(head-> sx));
swap_int_4(&(head-> sy));
swap_int_4(&(head-> gx));
swap_int_4(&(head-> gy));
swap_short_2(&(head-> counit));
swap_short_2(&(head-> wevel));
swap_short_2(&(head-> swevel));
swap_short_2(&(head-> sut));
swap_short_2(&(head-> gut));
swap_short_2(&(head-> sstat));
swap_short_2(&(head-> gstat));
swap_short_2(&(head-> tstat));
swap_short_2(&(head-> laga));
swap_short_2(&(head-> lagb));
swap_short_2(&(head-> delrt));
swap_short_2(&(head-> muts));
swap_short_2(&(head-> mute));
swap_u_short_2(&(head-> ns));
swap_u_short_2(&(head-> dt));
swap_short_2(&(head-> gain));
swap_short_2(&(head-> igc));
swap_short_2(&(head-> igi));
swap_short_2(&(head-> corr));
swap_short_2(&(head-> sfs));
swap_short_2(&(head-> sfe));
swap_short_2(&(head-> slen));
swap_short_2(&(head-> styp));
swap_short_2(&(head-> stas));
swap_short_2(&(head-> stae));
swap_short_2(&(head-> tatyp));
swap_short_2(&(head-> afilf));
swap_short_2(&(head-> afils));
swap_short_2(&(head-> nofilf));
swap_short_2(&(head-> nofils));
swap_short_2(&(head-> lcf));
swap_short_2(&(head-> hcf));
swap_short_2(&(head-> lcs));
swap_short_2(&(head-> hcs));
swap_short_2(&(head-> year));
swap_short_2(&(head-> day));
swap_short_2(&(head-> hour));
swap_short_2(&(head-> minute));
swap_short_2(&(head-> sec));
swap_short_2(&(head-> timbas));
swap_short_2(&(head-> trwf));
swap_short_2(&(head-> grnors));
swap_short_2(&(head-> grnofr));
swap_short_2(&(head-> grnlof));
swap_short_2(&(head-> gaps));
swap_short_2(&(head-> otrav));
swap_float_4(&(head-> d1));
swap_float_4(&(head-> f1));
swap_float_4(&(head-> d2));
swap_float_4(&(head-> f2));
swap_float_4(&(head-> ungpow));
swap_float_4(&(head-> unscale));
swap_int_4(&(head-> ntr));
swap_short_2(&(head-> mark));
swap_short_2(&(head-> shortpad));
swap_short_2(&(head-> unass[0]));
swap_short_2(&(head-> unass[1]));
swap_short_2(&(head-> unass[2]));
swap_short_2(&(head-> unass[3]));
swap_short_2(&(head-> unass[4]));
swap_short_2(&(head-> unass[5]));
swap_short_2(&(head-> unass[6]));
swap_short_2(&(head-> unass[7]));
swap_short_2(&(head-> unass[8]));
swap_short_2(&(head-> unass[9]));
swap_short_2(&(head-> unass[10]));
swap_short_2(&(head-> unass[11]));
swap_short_2(&(head-> unass[12]));
swap_short_2(&(head-> unass[13]));
}
void swap4(void *tt)
{
char *t=(char *)tt;
char tmp;
tmp=*t;
*t=*(t+3);
*(t+3)=tmp;
tmp=*(t+1);
*(t+1)=*(t+2);
*(t+2)=tmp;
}
void swap2(void *tt)
{
char *t=(char *)tt;
char tmp;
tmp=*t;
*t=*(t+1);
*(t+1)=tmp;
}
void swap8(void *tt)
{
char *t=(char *)tt;
char tmp;
tmp=*t;
*t=*(t+7);
*(t+7)=tmp;
tmp=*(t+1);
*(t+1)=*(t+6);
*(t+6)=tmp;
tmp=*(t+2);
*(t+2)=*(t+5);
*(t+5)=tmp;
tmp=*(t+3);
*(t+3)=*(t+4);
*(t+4)=tmp;
}
void swap2Arr(void *arr,int len)
{
int i;
char *Arr=(char *)arr;
for(i=0; i<len; i++)
{
swap2(Arr+2*i);
}
}
void swap4Arr(void *arr,int len)
{
int i;
char *Arr=(char *)arr;
for(i=0; i<len; i++)
{
swap4(Arr+4*i);
}
}
void swap8Arr(void *arr,int len)
{
int i;
char *Arr=(char *)arr;
for(i=0; i<len; i++)
{
swap8(Arr+8*i);
}
}
void swap_short_2(short *tni2)
/**************************************************************************
swap_short_2 swap a short integer
***************************************************************************/
{
swap2(tni2);
}
void swap_u_short_2(unsigned short *tni2)
/**************************************************************************
swap_u_short_2 swap an unsigned short integer
***************************************************************************/
{
swap2(tni2);
}
void swap_int_4(int *tni4)
/**************************************************************************
swap_int_4 swap a 4 byte integer
***************************************************************************/
{
swap4(tni4);
}
void swap_u_int_4(unsigned int *tni4)
/**************************************************************************
swap_u_int_4 swap an unsigned integer
***************************************************************************/
{
swap4(tni4);
}
void swap_long_4(long *tni4)
/**************************************************************************
swap_long_4 swap a long integer
***************************************************************************/
{
swap4(tni4);
}
void swap_u_long_4(unsigned long *tni4)
/**************************************************************************
swap_u_long_4 swap an unsigned long integer
***************************************************************************/
{
swap4(tni4);
}
void swap_float_4(float *tnf4)
/**************************************************************************
swap_float_4 swap a float
***************************************************************************/
{
swap4(tnf4);
}
void swap_double_8(double *tndd8)
/**************************************************************************
swap_double_8 swap a double
***************************************************************************/
{
swap8(tndd8);
}
double aver_d(double *tmp,int M)
{
int i;double a=0;
for(i=0;i<M;i++)
a+=tmp[i]/M;
return a;
}
float aver_f(float *tmp,int M)
{
int i;float a=0;
for(i=0;i<M;i++)
a+=tmp[i]/M;
return a;
}
float max_f(float *tmp,int M)
{
int i;float a=0;
for(i=1;i<M;i++)
if(a<fabs(tmp[i]))
a=(float)fabs(tmp[i]);
return a;
}
float min_f(float *tmp,int M)
{
int i;float a=tmp[0];
for(i=1;i<M;i++)
if(a>tmp[i])a=tmp[i];
return a;
}
float liner_value(float x1,float y1,float x2,float y2,float x3)
{
return (y2*(x3-x1)+y1*(x2-x3))/(x2-x1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -