# Parity bit generation

## Detailed Description

     #include <avr/parity.h>

This header file contains optimized assembler code to calculate the parity bit for a byte.

## Defines

#define | parity_even_bit(val)

## Define Documentation

#define parity_even_bit | ( | val |  | ) |

Value:

    ({                              \
            unsigned char __t;                              \
            __asm__ (                                       \
                    "mov __tmp_reg__,%0" "\n\t"             \
                    "swap %0" "\n\t"                        \
                    "eor %0,__tmp_reg__" "\n\t"             \
                    "mov __tmp_reg__,%0" "\n\t"             \
                    "lsr %0" "\n\t"                         \
                    "lsr %0" "\n\t"                         \
                    "eor %0,__tmp_reg__"                    \
                    : "=r" (__t)                            \
                    : "0" ((unsigned char)(val))            \
                    : "r0"                                  \
            );                                              \
            (((__t + 1) >> 1) & 1);                         \
     })

Returns:
  1 if `val` has an odd number of bits set.

Automatically generated by Doxygen 1.4.1 on 13 Oct 2005.