y_bit.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /**
  2. * <library name="y_bit">
  3. * <section>
  4. * Description
  5. * </section>
  6. * Provides functions for bit manipulation and bit arrays greater than 32bits.
  7. * The arrays are usually bigger than required due to cell boundaries but this
  8. * shouldn't cause a major problem (bit tests on the 101st bit of a 100 bit
  9. * array won't return 0 for out of bounds, but the 129th will).
  10. *
  11. * Note that y_commands has a few optimisations which bypass the code in here
  12. * so any modifications to bit array layouts will need to be reflected there.
  13. * <section>
  14. * Version
  15. * </section>
  16. * 0.2
  17. * <section>
  18. * Functions
  19. * </section>
  20. * <subsection>
  21. * Stock
  22. * </subsection><ul>
  23. * <symbol name="Bit_Set">Sets a slot to the given value.</symbol>
  24. * <symbol name="Bit_Get">Gets a slot state.</symbol>
  25. * <symbol name="Bit_SetAll">Sets all the slots in an array to the same thing.</symbol>
  26. * <symbol name="Bit_GetCount">Gets the number of 1s in a bit array.</symbol>
  27. * </ul><subsection>
  28. * Inline
  29. * </subsection><ul>
  30. * <symbol name="Bit_Bits">Gets the number of cells required for a bit array.</symbol>
  31. * <symbol name="Bit_Let">Sets a slot to 1.</symbol>
  32. * <symbol name="Bit_Vet">Sets a slot to 0.</symbol>
  33. * <symbol name="Bit_GetBits">Gets the bit at a slot unsafely.</symbol>
  34. * </ul><section>
  35. * Definitions
  36. * </section><ul>
  37. * <symbol name="CELLSHIFT">Number of bits that can hold "cellbits"</symbol>
  38. * </ul><section>
  39. * Tags
  40. * </section><ul>
  41. * <symbol name="Bit">Bit array type.</symbol>
  42. * </ul>
  43. * </library>
  44. *//** *//*
  45. Legal:
  46. Version: MPL 1.1
  47. The contents of this file are subject to the Mozilla Public License Version
  48. 1.1 the "License"; you may not use this file except in compliance with
  49. the License. You may obtain a copy of the License at
  50. http://www.mozilla.org/MPL/
  51. Software distributed under the License is distributed on an "AS IS" basis,
  52. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  53. for the specific language governing rights and limitations under the
  54. License.
  55. The Original Code is the YSI framework.
  56. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  57. Portions created by the Initial Developer are Copyright C 2011
  58. the Initial Developer. All Rights Reserved.
  59. Contributors:
  60. Y_Less
  61. koolk
  62. JoeBullet/Google63
  63. g_aSlice/Slice
  64. Misiur
  65. samphunter
  66. tianmeta
  67. maddinat0r
  68. spacemud
  69. Crayder
  70. Dayvison
  71. Ahmad45123
  72. Zeex
  73. irinel1996
  74. Yiin-
  75. Chaprnks
  76. Konstantinos
  77. Masterchen09
  78. Southclaws
  79. PatchwerkQWER
  80. m0k1
  81. paulommu
  82. udan111
  83. Thanks:
  84. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  85. ZeeX - Very productive conversations.
  86. koolk - IsPlayerinAreaEx code.
  87. TheAlpha - Danish translation.
  88. breadfish - German translation.
  89. Fireburn - Dutch translation.
  90. yom - French translation.
  91. 50p - Polish translation.
  92. Zamaroht - Spanish translation.
  93. Los - Portuguese translation.
  94. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  95. me to strive to better.
  96. Pixels^ - Running XScripters where the idea was born.
  97. Matite - Pestering me to release it and using it.
  98. Very special thanks to:
  99. Thiadmer - PAWN, whose limits continue to amaze me!
  100. Kye/Kalcor - SA:MP.
  101. SA:MP Team past, present and future - SA:MP.
  102. Optional plugins:
  103. Gamer_Z - GPS.
  104. Incognito - Streamer.
  105. Me - sscanf2, fixes2, Whirlpool.
  106. */
  107. #if !defined _INC_y_bit
  108. #tryinclude "y_bit\y_bit_entry"
  109. #endif
  110. #if !defined _INC_y_bit
  111. #tryinclude "YSI_Data\y_bit\y_bit_entry"
  112. #endif
  113. #if !defined _INC_y_bit
  114. #tryinclude "YSI\YSI_Data\y_bit\y_bit_entry"
  115. #endif
  116. #if !defined _INC_y_bit
  117. #tryinclude <YSI_Data\y_bit\y_bit_entry>
  118. #endif
  119. #if !defined _INC_y_bit
  120. #tryinclude <YSI\YSI_Data\y_bit\y_bit_entry>
  121. #endif
  122. #if !defined _INC_y_bit
  123. #error Could not find y_bit
  124. #endif