https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207854

Gleb Popov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Gleb Popov <[email protected]> ---
Not sure how UL would help here, since unsigned long is also 32-bits. The
proper fix is to use tmpN modulo 32 as shift operand. Verified this on
standalone example:

#include <stdio.h>
#include <sys/types.h>

int main(int argc, char* argv[])
{
    uint32_t tmpN;
    int tmp;
    for (tmpN=7 ; tmpN<64; tmpN++ )
    {
        //tmp = (1<<(tmpN%32));
        tmp = (1UL<<(tmpN%32));
        printf("%d\n", tmp);
    }
    return 0;
}


Patch for the problem:

Index: sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c
===================================================================
--- sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c     (revision 353638)
+++ sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c     (working copy)
@@ -1468,7 +1468,7 @@
     for (tmpA=(uint32_t)(64*pres) ; tmpA<128*pres; tmpA += pres )
         for (tmpN=7 ; tmpN<64; tmpN++ )
         {
-            tmp = ABS((int)(slope - tmpA/(1<<tmpN)));
+            tmp = ABS((int)(slope - tmpA/(1UL<<(tmpN%32))));
             if (tmp < gap)
             {
                sa = tmpA;

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to