Code Monkey home page Code Monkey logo

Comments (4)

ThomasAdam avatar ThomasAdam commented on June 3, 2024

I suspect this is because the array index is int c. I suspect using unsigned int c will make the warning go away.

However, since I can't generate this warning on Unix, I'm taking an educating guess. But do please try it and see what happens.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 3, 2024

Thanks, for the reply Thomas. I logged the bug to make sure I didn't forget but didn't check the code immediately. Looking at it now I think I can see the problem. The line the compiler highlights is in the loop:

for (c = 0; c < 16; c++)
{
    if ((ula_palbak[c] & 8) && nula_flash[c-8]) ula_pal[c] = nula_collook[ula_palbak[c] & 15];
    else                 ula_pal[c] = nula_collook[(ula_palbak[c] & 15) ^ 7];
}

With c varying between 0 and 15 the expression nula_flash[c-8] looks problematic. Of course, the test in the if statement may mean this is never executed when c < 8 but I don't know enough about how this code works. Interestingly the compiler has issued eight warnings for the same line which means it must have decided to unroll this loop and hence eight out of the 16 iterations generate the warning.

Kieran, one for you, I think.

from b-em.

hoglet67 avatar hoglet67 commented on June 3, 2024

I would change the c-8 to c&7, it will have the same effect, but can't go negative.

from b-em.

SteveFosdick avatar SteveFosdick commented on June 3, 2024

That solves the warning. I have made the change and pushed it to master.

from b-em.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.