[英]Accessing an array using pointer is not working during porting to ARM
I am new to the ARM platform. 我是ARM平台的新手。
Below code has been used in an function for finding out the conjugate multiplication of some complex numbers of samples and sliding it to a some samples. 下面的代码已用于函数中,以找出一些复数样本的共轭乘法并将其滑动到一些样本。
This code was working properly in native compiler in linux 12.04 version. 此代码在linux 12.04版本的本机编译器中正常工作。 When running the same code in ARM, it doesn't execute that function.
在ARM中运行相同的代码时,它不会执行该功能。 It just exits from the code running.
它只是从运行代码中退出。
#include<stdio.h>
int main()
{
float aa[12]={1,1,1,1,1,1,1,1,1,1,1,1};
float *x=aa,*y=x+6,real=0,imag=0;
fn_ComplexMultiply_addthem(x,y,6,&real,&imag);
printf("real value = %f\n",real);
printf("real value = %f\n",imag);
}
void fn_ComplexMultiply_addthem(float *x, float *y, float len, float *re, float *im)
{
int j;
for( j=0; j<len; j+=2)
{
*re += (x[j]*(y[j]));
*re -= (x[j+1]*(-y[j+1]));
*im += (x[j]*(-y[j+1]));
*im += (x[j+1]*(y[j]));
}
}
I couldn't understand the reason for it. 我不明白原因。 Each pointer is pointing to some value then it should give me the result whatever the may be right.
每个指针都指向某个值,那么无论哪种方法都应该给我结果。 Instead its just exits from the simulation.
相反,它只是从模拟中退出。
Will it problem with some other things like memory such as stack or others? 是否会遇到诸如堆栈之类的内存之类的其他问题? Please help me to debug this one.
请帮我调试一下。
The program is invalid because fn_ComplexMultiply_addthem
is used before it is declared, and an implicit declaration would not match the actual definition. 该程序无效,因为
fn_ComplexMultiply_addthem
在声明之前fn_ComplexMultiply_addthem
使用,并且隐式声明与实际定义不匹配。
In addition, float len
makes no sense. 另外,
float len
毫无意义。 We don't use floating point numbers for counting. 我们不使用浮点数进行计数。
Change len
to int
and add the function declaration before main
: 将
len
更改为int
并在main
之前添加函数声明:
void fn_ComplexMultiply_addthem(float *x, float *y, int len, float *re, float *im);
ALWAYS enable compiler warning and treat them as errors ( -Wall -Werror
for gcc and clang). 始终启用编译器警告并将其视为错误(对于gcc和clang,
-Wall -Werror
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.