Ticket #415: dirty_sqrt.diff

File dirty_sqrt.diff, 448 bytes (added by jehan.dev, 12 years ago)

Dirty patch

  • navit/navit/graphics.c

    diff --git a/navit/navit/graphics.c b/navit/navit/graphics.c
    index 5e722f8..54b3a86 100644
    a b static int 
    10001000int_sqrt(unsigned int n)
    10011001{
    10021002        unsigned int h, p= 0, q= 1, r= n;
    1003         while ( q <= n )
     1003        while ( q <= n ) {
    10041004                q <<= 2;
     1005                if(q == 0) {
     1006                        return (int) sqrtf( (float) n ); /* use float sqrt if we reach q MAX */
     1007                }
     1008        }
    10051009        while ( q != 1 ) {
    10061010                q >>= 2;
    10071011                h = p + q;