注册 登录
编程论坛 C++教室

一个关于于运算的问题?

又0又 发布于 2010-07-29 13:07, 875 次点击
因为自学编程语言不久。这个问题一直纠结着,希望能得到些帮助。


float index;


index=index+1;
index=index-(index>=10000)&10000;

上面这串代码是什么意思呢?能具体的说说嘛?

原谅我的愚笨

多谢。。。。。
5 回复
#2
mxs8102010-07-29 14:35
不知道楼主那个地方有疑惑呢?
#3
lampeter1232010-07-29 16:37
没有上下文,很难说明以上代码是干什么的
#4
flyingcloude2010-07-29 18:26
&不能对float进行操作的。
#5
flyingcloude2010-07-29 18:30
所以你的代码应该不能通过编译的。

如果index是int类型的话,
index = index - (index >= 10000) & 10000;

index >= 10000 要么是1要么是0,index - (index >= 10000) 再与。
#6
又0又2010-07-30 16:26
streamin in;
streamout out;
streamin freq;

float index;
float f,frac;
float temp1,temp2;
float x1;

float mem[10000];

temp1 = freq - 0.5;
f = rndint(temp1);
frac = freq - f;

index=index+1;
index=index-(index>=10000)&10000;

mem[index]=in;

temp1 = index - f;
temp1 = temp1 + (temp1 < 0)&10000;
temp1 = mem[temp1];

temp2 = index - f - 1;
temp2 = temp2 + (temp2 < 0)&10000;
temp2 = mem[temp2];

out = (1 - frac) * temp1 + frac * temp2;

多谢上面的朋友的耐心回复。
全局代码来了
这是一个DSP效果器的算法代码。。。。。不太明白。。
1