1/1

|
how to make the division?
by Unknown on Sep 2, 2004 |
Not available! | ||
|
I met some questions when compiling a C file:
In one function ,I had to make recursion as follows: int schur( int * ac, int * ref) { int i,m,r,energy = ac[0]; int G[2][P_MAX]; if (ac[0] == 0) { for (i = 0; i return 0; } for (i = 0; i for (i = 0;;) { ref = r = -G[1][0]*/energy; // Here is the mistake!!!! energy += (G[1][0] * r); if (++i >= P_MAX) return error; for (m = 0; m { G[1][m] = G[1][m + 1] + r * G[0][m]; G[0][m] = G[1][m + 1] * r+ G[0][m]; } } } because the variable "energy" isn't the power of 2, the error comes when compiling: recorder.o :in function'__schur': recorder.o(.text+0x7b0): undefined referrence to '___divsi3' make ***(recorder) error 1 but the variable 'energy ' changes every recursion, it's hard to set the power of 2 to approach 'energy'. How can i do ? Is it has some *.lib or *.h to be included to solve the problem? thank you |
|||
|
how to make the division?
by Unknown on Sep 17, 2004 |
Not available! | ||
|
* beyoelf@163.com (beyoelf@163.com) wrote:
I met some questions when compiling a C file:
In one function ,I had to make recursion as follows: int schur( int * ac, int * ref) { int i,m,r,energy = ac[0]; int G[2][P_MAX]; if (ac[0] == 0) { for (i = 0; i return 0; } for (i = 0; i for (i = 0;;) { ref = r = -G[1][0]*/energy; // Here is the mistake!!!! energy += (G[1][0] * r); if (++i >= P_MAX) return error; for (m = 0; m { G[1][m] = G[1][m + 1] + r * G[0][m]; G[0][m] = G[1][m + 1] * r+ G[0][m]; } } } because the variable "energy" isn't the power of 2, the error comes when compiling: recorder.o :in function'__schur': recorder.o(.text+0x7b0): undefined referrence to '___divsi3' make ***(recorder) error 1 but the variable 'energy ' changes every recursion, it's hard to set the power of 2 to approach 'energy'. How can i do ? Is it has some *.lib or *.h to be included to solve the problem? thank you simple, you need to link with libgcc.a (the or32 version of course). iy you have hardware division you can also pass -mhard-div option to compiler and it will generate l.div instruction instead of using ___div* functions. best reagards, p. |
|||
1/1

