Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/24/06 15:57
Read: times


 
#112984 - Or another portable solution?
Responding to: ???'s previous message
unsigned char OddParity(unsigned char b)
{
    b ^= b >> 4;
    b ^= b >> 2;
    b ^= b >> 1;

    return (~b & 1);
}

Or if you also need even parity elsewhere:
#define ODD_PARITY(b) (EvenParity(b) ^ 1)

unsigned char EvenParity(unsigned char b)
{
    b ^= b >> 4;
    b ^= b >> 2;
    b ^= b >> 1;

    return (b & 1);
}


List of 30 messages in thread
TopicAuthorDate
odd parity problem            01/01/70 00:00      
   In Raisonance and Keil            01/01/70 00:00      
      OR            01/01/70 00:00      
         How about a portable solution?            01/01/70 00:00      
            calculating parity..            01/01/70 00:00      
            portable my ...            01/01/70 00:00      
         Or another portable solution?            01/01/70 00:00      
         And one more fast method            01/01/70 00:00      
            fast?            01/01/70 00:00      
               Yep            01/01/70 00:00      
                  Bag of Tricks            01/01/70 00:00      
                     bag of tricks..            01/01/70 00:00      
                        Good link. Thanks.            01/01/70 00:00      
                     Collecting            01/01/70 00:00      
                        ciontradictory request            01/01/70 00:00      
                           One confused puppy            01/01/70 00:00      
                              not confused            01/01/70 00:00      
                                 I/O and parity for '51 belongs in Chat            01/01/70 00:00      
                                    If memory parity were implemented, I sur            01/01/70 00:00      
                                       Memory -- expand your thinking a little            01/01/70 00:00      
                                          eeprom would be I/O            01/01/70 00:00      
                                             Memory plus software parity            01/01/70 00:00      
                                             8051 does calculate parity!            01/01/70 00:00      
                                                ALU versus I/O            01/01/70 00:00      
                  no such thought            01/01/70 00:00      
                     My two cents            01/01/70 00:00      
                        Choosing by architecture            01/01/70 00:00      
            thanks:) 18 Bytes each!            01/01/70 00:00      
               "Old" Europe            01/01/70 00:00      
   Simple method            01/01/70 00:00      

Back to Subject List