home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / laserlib / inc / boolop.h next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  3.2 KB  |  62 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*  NAME:         boolop.h                                                */
  4. /*                                                                        */
  5. /*  DATUM:        13.07.89                                                */
  6. /*                                                                        */
  7. /*  BESCHREIBUNG: Enthaelt Macros fuer Boolesche Operationen, sowie zum   */
  8. /*                Setzten, Abfragen und Ruecksetzen von Bits.             */
  9. /*                                                                        */
  10. /*  AENDERUNGEN:  CH071088 - Prototyp.                                    */
  11. /*                CH081088 - BOGetVal, ...                                */
  12. /*                CH161088 - Klammern in BOGetBit(...                     */
  13. /*                CH221188 - #define BOOLOP eingefuegt.                   */
  14. /*                CH130789 - um BOTogVal(), BOTogBit() erweitert          */
  15. /*                         - BOOLOP -> BOOLOPH geaendert                  */
  16. /*                                                                        */
  17. /*  ERWEITERUNG:  - rotate                                                */
  18. /*                - operatoren aendern ~, ^.                              */
  19. /*                                                                        */
  20. /**************************************************************************/
  21.  
  22. #ifndef BOOLOPH
  23. #define BOOLOPH
  24.  
  25. #define BOKontra(a,b)  (0)                         /*  0. 0000 */
  26. #define BOKonjunk(a,b) (a & b)                     /*  1. 0001 */
  27. #define BODisAImp(a,b) (a & !b)                    /*  2  0010 */
  28. #define BOAIdent(a,b)  (a)                         /*  3. 0011 */
  29. #define BODisBImp(a,b) (!a & b)                    /*  4. 0100 */
  30. #define BOBIdent(a,b)  (b)                         /*  5. 0101 */
  31. #define BOValenz(a,b)  ((a & b) | (!a & !b))       /*  9. 1001 */
  32. #define BODisval(a,b)  (!(BOValenz(a,b)))          /*  6. 0110 */
  33. #define BODisjunk(a,b) (a | b)                     /*  7. 0111 */
  34. #define BOPierce(a,b)  (!(a | b))                  /*  8. 1000 */
  35. #define BOBKompl(a,b)  (!b)                        /* 10. 1010 */
  36. #define BOBImpli(a,b)  (a | !b)                    /* 11. 1011 */
  37. #define BOAKompl(a,b)  (!a)                        /* 12. 1100 */
  38. #define BOAImpli(a,b)  (!a | b)                    /* 13. 1101 */
  39. #define BOSheffer(a,b) (!(a & b))                  /* 14. 1110 */
  40. #define BOTautol(a,b)  (1)                         /* 15. 1111 */
  41.  
  42. #define BONegate(a)    (!a)
  43.  
  44. #define BOAND(a,b)     (BOKonjunk(a,b))
  45. #define BOOR(a,b)      (BODisjunk(a,b))
  46. #define BONAND(a,b)    (BOSheffer(a,b))
  47. #define BONOR(a,b)     (BOPierce(a,b))
  48. #define BONOT(a)       (BONegate(a))
  49.  
  50. #define BOGetVal(f,v)   (((f) & (v)) == v)
  51. #define BOSetVal(f,v)   ((f) |= (v))
  52. #define BOResetVal(f,v) ((f) &= ~(v))
  53. #define BOTogVal(f,v)   (BOGetVal(f,v) ? BOResetVal(f,v) : BOSetVal(f,v))
  54.  
  55. #define BOGetBit(f,b)   (BOGetVal(f, (1 << b)))
  56. #define BOSetBit(f,b)   (BOSetVal(f, (1 << b)))
  57. #define BOResetBit(f,b) (BOResetVal(f, (1 << b)))
  58. #define BOTogBit(f,b)   (BOTogVal(f, (1 << b)))
  59.  
  60. #endif BOOLOPH
  61.  
  62.