Merge lp:~xnox/cuneiform-linux/fix-missing-libm into lp:cuneiform-linux

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: lp:~xnox/cuneiform-linux/fix-missing-libm
Merge into: lp:cuneiform-linux
Diff against target: 11 lines (+1/-0)
1 file modified
cuneiform_src/Kern/leo/CMakeLists.txt (+1/-0)
To merge this branch: bzr merge lp:~xnox/cuneiform-linux/fix-missing-libm
Reviewer Review Type Date Requested Status
Jussi Pakkanen Pending
Review via email: mp+24187@code.launchpad.net

Description of the change

Thanks JussiP the suggested fix works on Debian. I'll add it to packaging and seek sponsorship together with a lead maintainer to get updated version uploaded to Debian -> Ubuntu (targetting Maverick 10.10).

To post a comment you must log in.
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I don't want to merge this immediately because:

a) it's not required for build on any platform
b) I don't know what MSVC etc will do, especially since other libraries that use sqrt seem to work fine

I suggest that this is kept as a Debian distro patch for the moment.

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

On 27 April 2010 12:49, JussiP <email address hidden> wrote:
> I don't want to merge this immediately because:
>
> a) it's not required for build on any platform
> b) I don't know what MSVC etc will do, especially since other libraries that use sqrt seem to work fine
>
> I suggest that this is kept as a Debian distro patch for the moment.

Fair enough =) i've tested this across a few debian/ubuntu releases in
a chroot environments. I do not have access to MSVC/msys platforms.

Please do not unlink this branch from the bug report =) cause that's
the url I'm using to describe the patch (where it came from & why) for
debian packaging we need to document that ;-)

Please note that everywhere else in the codebase long_sqrt() is used
not sqrt() maybe that's the cause of the problem?

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :
Download full text (4.3 KiB)

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);
c...

Read more...

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Download full text (4.8 KiB)

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...

Read more...

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

I replaced all fixed point with system's sqrt, which is almost three times faster, too.

Unmerged revisions

472. By Dimitri John Ledkov

Link leo with libm - Debian QA scripts complained about missing link

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cuneiform_src/Kern/leo/CMakeLists.txt'
--- cuneiform_src/Kern/leo/CMakeLists.txt 2010-01-14 11:55:16 +0000
+++ cuneiform_src/Kern/leo/CMakeLists.txt 2010-04-27 00:25:33 +0000
@@ -23,6 +23,7 @@
23msk3223msk32
24r353224r3532
25std3225std32
26m
26)27)
2728
28library_hook(leo32)29library_hook(leo32)

Subscribers

People subscribed via source and target branches