/[avr-libc]/avr-libc/include/avr/parity.h
ViewVC logotype

Diff of /avr-libc/include/avr/parity.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by joerg_wunsch, Thu Sep 8 21:16:59 2005 UTC revision 1.7 by joerg_wunsch, Sat Nov 5 22:23:15 2005 UTC
# Line 1  Line 1 
1  /* Copyright (c) 2002, Marek Michalkiewicz  /* Copyright (c) 2005 Joerg Wunsch
    Copyright (c) 2004, Joerg Wunsch  
2     All rights reserved.     All rights reserved.
3    
4     Redistribution and use in source and binary forms, with or without     Redistribution and use in source and binary forms, with or without
# Line 31  Line 30 
30    
31  /* $Id$ */  /* $Id$ */
32    
 /* avr/parity.h - optimized code to calculate parity bit of a byte */  
   
33  #ifndef _AVR_PARITY_H_  #ifndef _AVR_PARITY_H_
34  #define _AVR_PARITY_H_  #define _AVR_PARITY_H_
35    
36  /** \defgroup avr_parity <avr/parity.h>: Parity bit generation  #warning "This file has been moved to <util/parity.h>."
37      \code #include <avr/parity.h> \endcode  #include <util/parity.h>
   
     This header file contains optimized assembler code to calculate  
     the parity bit for a byte.  
 */  
 /** \def parity_even_bit  
     \ingroup avr_parity  
     \returns 1 if \c val has an odd number of bits set. */  
 #define parity_even_bit(val)                            \  
 (__extension__({                                        \  
         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);                         \  
  }))  
38    
39  #endif /* _AVR_PARITY_H_ */  #endif /* _AVR_PARITY_H_ */

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26