flags.h.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. flags.h
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='files.h.html' title=' files.h '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='format.h.html' title=' format.h '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * flags.h - bitmap flagword definitions and declarations;
  24. *
  25. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  26. * Copyright 2001-2006 by Charles Maier Associates;
  27. * Licensed under the Internet Software Consortium License;
  28. *
  29. *--------------------------------------------------------------------*/
  30. #ifndef FLAGS_HEADER
  31. #define FLAGS_HEADER
  32. /*====================================================================*
  33. * system header files;
  34. *--------------------------------------------------------------------*/
  35. #include &lt;stdint.h&gt;
  36. /*====================================================================*
  37. * define macros for common, but error prone, bitmap operations;
  38. *--------------------------------------------------------------------*/
  39. #define _bits(object) (sizeof (object) &lt;&lt; 3)
  40. #define _getbits(map,pos,cnt) (((map)&gt;&gt;((pos)-(cnt)+1))&amp;~(~(0)&lt;&lt;(cnt)))
  41. #define _bitmask(bits) ~(~(0) &lt;&lt; bits)
  42. #define _setbits(flag,mask) flag |= (mask)
  43. #define _clrbits(flag,mask) flag &amp;= ~(mask)
  44. #define _toggle(flag,mask) flag = ~(flag) &amp; ~(mask)
  45. #define _anyset(flag,mask) ((flag) &amp; (mask)) != (0)
  46. #define _anyclr(flag,mask) ((flag) &amp; (mask)) != (mask)
  47. #define _allset(flag,mask) ((flag) &amp; (mask)) == (mask)
  48. #define _allclr(flag,mask) ((flag) &amp; (mask)) == (0)
  49. // #define _notset(flag,mask) ((flag) &amp; (mask)) == (0)
  50. #define _anybits(flag,mask) ((flag) &amp; (mask)) != (0)
  51. #define _allbits(flag,mask) ((flag) &amp; (mask)) == (mask)
  52. #define _clean(flag,mask) ((flag) &amp; ~(mask)) == (0)
  53. #define _dirty(flag,mask) ((flag) &amp; ~(mask)) != (0)
  54. /*====================================================================*
  55. *
  56. *--------------------------------------------------------------------*/
  57. void set32bitmap (uint32_t * map, unsigned bit);
  58. void clr32bitmap (uint32_t * map, unsigned bit);
  59. /*====================================================================*
  60. * end definitions and declarations;
  61. *--------------------------------------------------------------------*/
  62. #endif
  63. </pre>
  64. <div class='footerlink'>
  65. [<a href='files.h.html' title=' files.h '>PREV</a>]
  66. [<a href='toolkit.html' title=' Index '>HOME</a>]
  67. [<a href='format.h.html' title=' format.h '>NEXT</a>]
  68. </div>
  69. </body>
  70. </html>