This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Complement of Char

Is any direct function is available for the complement of the char variable

Parents
  • the OP mentioned "this is about a bit"
    so, let us make it about a bit and we'll earn money when being paid per line of code:

    U8 ComplementChar(U8 Phred)
    {
    
      if (Phred & 0x01)
      {
        Phred &= 0xfe;
      }
      else
      {
        Phred |= 0x01;
      }
    
      if (Phred & 0x02)
      {
        Phred &= 0xfd;
      }
      else
      {
        Phred |= 0x02;
      }
    
      if (Phred & 0x04)
      {
        Phred &= 0xfb;
      }
      else
      {
        Phred |= 0x04;
      }
    
      if (Phred & 0x08)
      {
        Phred &= 0xf7;
      }
      else
      {
        Phred |= 0x08;
      }
    
      if (Phred & 0x10)
      {
        Phred &= 0xef;
      }
      else
      {
        Phred |= 0x10;
      }
    
      if (Phred & 0x20)
      {
        Phred &= 0xdf;
      }
      else
      {
        Phred |= 0x20;
      }
    
      if (Phred & 0x40)
      {
        Phred &= 0xbf;
      }
      else
      {
        Phred |= 0x40;
      }
    
      if (Phred & 0x80)
      {
        Phred &= 0x7f;
      }
      else
      {
        Phred |= 0x80;
      }
    } // end ComplementChar
    

    Erik

Reply
  • the OP mentioned "this is about a bit"
    so, let us make it about a bit and we'll earn money when being paid per line of code:

    U8 ComplementChar(U8 Phred)
    {
    
      if (Phred & 0x01)
      {
        Phred &= 0xfe;
      }
      else
      {
        Phred |= 0x01;
      }
    
      if (Phred & 0x02)
      {
        Phred &= 0xfd;
      }
      else
      {
        Phred |= 0x02;
      }
    
      if (Phred & 0x04)
      {
        Phred &= 0xfb;
      }
      else
      {
        Phred |= 0x04;
      }
    
      if (Phred & 0x08)
      {
        Phred &= 0xf7;
      }
      else
      {
        Phred |= 0x08;
      }
    
      if (Phred & 0x10)
      {
        Phred &= 0xef;
      }
      else
      {
        Phred |= 0x10;
      }
    
      if (Phred & 0x20)
      {
        Phred &= 0xdf;
      }
      else
      {
        Phred |= 0x20;
      }
    
      if (Phred & 0x40)
      {
        Phred &= 0xbf;
      }
      else
      {
        Phred |= 0x40;
      }
    
      if (Phred & 0x80)
      {
        Phred &= 0x7f;
      }
      else
      {
        Phred |= 0x80;
      }
    } // end ComplementChar
    

    Erik

Children