Code review comment for lp:~xnox/cuneiform-linux/fix-missing-libm

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

On 6 May 2010 09:38, JussiP <email address hidden> wrote:
> Grep says the following:
>
> ------
>
> grep sqrt cuneiform_src/**/*.c*
>
> cuneiform_src/Kern/leo/src/leo_stic.c:static uchar sqrt_tab[] = {
> cuneiform_src/Kern/leo/src/leo_stic.c:            sqrt(vSticks[i].Mx*vSticks[i].Mx+vSticks[i].My*vSticks[i].My);
> cuneiform_src/Kern/lns32/src/lbambuk.cpp:               max_width = (int)(ave_width + sqrt(dispers) + 1);
> cuneiform_src/Kern/r35/src/r35.c:amax = sqrt(amax);
> cuneiform_src/Kern/r35/src/r35.c:amax = sqrt(amax);
> cuneiform_src/Kern/r35/src/r35.c:amax = sqrt(amax);
> cuneiform_src/Kern/r35/src/r35.c:sq = sqrt (sq);
> cuneiform_src/Kern/rblock/sources/c/ltwstrip.c:        Point.yAverage = (int) long_sqrt
> cuneiform_src/Kern/rblock/sources/c/ltwstrip.c:        (int) long_sqrt ((int32_t) yAverageHystHeight / nHystColumns);
> cuneiform_src/Kern/rblock/sources/c/scalar.c:static uchar sqrt_tab[] = {
> cuneiform_src/Kern/rblock/sources/c/scalar.c:int16_t long_sqrt (uint32_t n)
> cuneiform_src/Kern/rblock/sources/c/scalar.c: d = sqrt_tab[w]+1; d = d << sh; if ((d & 0xffff) == 0) return 0;
> cuneiform_src/Kern/rblock/sources/c/seform.c:        (int) long_sqrt ((int32_t) (nSumTopDispersion
> cuneiform_src/Kern/rblock/sources/c/seform.c:        (int) long_sqrt ((int32_t) (nSumBottomDispersion
> cuneiform_src/Kern/rfrmt/sources/main/pagetree.cpp:  sig=(long)sqrt(sig/(float)(n+1));
> cuneiform_src/Kern/rfrmt/sources/main/pagetree.cpp:    sig=(long)/*(float)*/sqrt(sig/(float)(n+1)); *sig1=(TYPE)sig;
> cuneiform_src/Kern/rfrmt/sources/main/util_spl.cpp:  sig=(long)sqrt(sig/(float)(n+1));
> cuneiform_src/Kern/rimage/sources/main/cribinarizator.cpp:      return (uchar)sqrt((((b * b) + (g * g) + (r * r)) / 70200 ) * 65025  );
> cuneiform_src/Kern/rimage/sources/main/crrotator.cpp:   long double   fG      = sqrt( fNum * fNum + fDenum * fDenum );
> cuneiform_src/Kern/rimage/sources/main/crrotator.cpp:   long double   fG      = sqrt( fNum * fNum + fDenum * fDenum );
> cuneiform_src/Kern/rselstr/sources/src/chstr/rotate/rotate.cpp: D=sqrt(D);
> cuneiform_src/Kern/rselstr/sources/src/cpp/scalar.cpp:static uchar sqrt_tab[] = { 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,
> cuneiform_src/Kern/rselstr/sources/src/cpp/scalar.cpp:int16_t long_sqrt(uint32_t n) {
> cuneiform_src/Kern/rselstr/sources/src/cpp/scalar.cpp:  d = sqrt_tab[w] + 1;
> cuneiform_src/Kern/rselstr/sources/src/cpp/seform.cpp:        (int) long_sqrt ((int32_t) (nSumTopDispersion
> cuneiform_src/Kern/rselstr/sources/src/cpp/seform.cpp:        (int) long_sqrt ((int32_t) (nSumBottomDispersion
> cuneiform_src/Kern/rstr/src/dmbox.c: if ((SBOX.matrBOX.isq_rt = long_sqrt((*scalar)(mBOX,mBOX)))==0)
> cuneiform_src/Kern/rstr/src/dms.c: if ((SBOX.matrBOX.isq_rt = long_sqrt((*scalar)(mBOX,mBOX)))==0)
> cuneiform_src/Kern/rstr/src/dms.c: if ((SBOX.matrBOX.isq_rt = long_sqrt((*scalar)(mBOX,mBOX)))==0)
> cuneiform_src/Kern/rstr/src/embbox.c: if ((norm = long_sqrt((*scalar)(vector, vector)))==0)  norm = 1;
> cuneiform_src/Kern/rstr/src/scalar.c:static uchar sqrt_tab[] = {
> cuneiform_src/Kern/rstr/src/scalar.c:int16_t long_sqrt (uint32_t n)
> cuneiform_src/Kern/rstr/src/scalar.c: d = sqrt_tab[w]+1; d = d << sh; if ((d & 0xffff) == 0) return 0;
> cuneiform_src/Kern/rverline/src/algoritm/verifyln.cpp:                  Dist  = (int) sqrt ((double)Dist);
> cuneiform_src/Kern/rverline/src/algoritm/verifyln.cpp:          Lent  = (int) sqrt ((double)Lent);
> cuneiform_src/Kern/rverline/src/algoritm/verifyln.cpp:          Lent  = (int) sqrt ((double)Lent);
> cuneiform_src/Kern/rverline/src/algoritm/verifyln.cpp:          Lent  = (int) sqrt ((double)Lent);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:              LentOld  = (int)sqrt ((double)LentOld);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:                      LentNew  = (int)sqrt ((double)LentNew);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:              LentOld  = (int)sqrt ((double)LentOld);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:                      LentNew  = (int)sqrt ((double)LentNew);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:      pLine->Len  = (int) sqrt ((double)pLine->Len);
> cuneiform_src/Kern/usage/line_vp_2_am.cpp:      pLine->Len  = (int) sqrt ((double)pLine->Len);
> cuneiform_src/Kern/usage/line_vp_util.cpp:                      Lent  = (int) sqrt ((double)Lent);
> cuneiform_src/Kern/usage/line_vp_util.cpp:                      Lent  = (int) sqrt ((double)Lent);
>
> ----
>
> According to this, leo has a sqrt_tab so it should probably use that. Other modules that use sqrt include r35, rfrmt, rimage, rverline, and usage. Why don't they give the link error? Is there some symbol resolution/linker magic going on?

I can create tables of exported symbol names, but they will be mangled....

> --
> https://code.launchpad.net/~dmitrij.ledkov/cuneiform-linux/fix-missing-libm/+merge/24187
> You are the owner of lp:~dmitrij.ledkov/cuneiform-linux/fix-missing-libm.
>

« Back to merge proposal