Menu

[76f95a]: progP16.cpp Line 217

2014-04-17
2014-04-18
  • Johan Hedlund

    Johan Hedlund - 2014-04-17

    Hello

    Hope this is the correct forum for technical questions.

    I am reviewing the code for Open Programmer. In line 217 of progP16.cpp there is the following statement:

    if(PIC16LIST[i].revmask&&(id>>5)==PIC16LIST[i].id){

    I think it seems like a bug that a logical and (&&) is done with a bitmask instead of a bitwise and (&). Is the code correct?

     
  • Alberto Maccioni

    Hi, in this case the revmask is used as a switch to detect new devices which have revision and id in different locations instead of combined.
    These devices are listed with revmask=0 in the array of all ids, so the code is correct, although it would be more readable using:
    if((PIC16LIST[i].revmask>0)&&((id>>5)==PIC16LIST[i].id)){

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.