Advertisement
Guest User

DBits ENGLISH

a guest
Jun 14th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.34 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*-
  2.  *
  3.  *  DBit - 16-bit and 8-bit arrays support.
  4.  *
  5.  *    created by Maximiliano Vega (MrDeath537)
  6.  *
  7. -*----------------------------------------------------------------------------*/
  8.  
  9.  
  10. #if !defined DBIT_INCLUDED
  11.     #define  DBIT_INCLUDED
  12. #else
  13.     #endinput
  14. #endif
  15.  
  16.  
  17. /*----------------------------------------------------------------------------*/
  18.  
  19.  
  20. stock
  21.     DBITS_VAR;
  22.  
  23.  
  24. /*----------------------------------------------------------------------------*/
  25.  
  26.  
  27. #define Bit16:%0<%1>                                                            \
  28.         %0[(%1)/2]
  29.  
  30. #define Bit8:%0<%1>                                                             \
  31.         %0[(%1) char]
  32.  
  33.  
  34. /*----------------------------------------------------------------------------*/
  35.  
  36.  
  37. #define Bit8_Get(%0,%1)                                                         \
  38.         (%0{(%1)})
  39.  
  40. #define Bit8_Set(%0,%1,%2)                                                      \
  41.         (%0{(%1)}=(%2))
  42.  
  43.  
  44. /*----------------------------------------------------------------------------*/
  45.  
  46.  
  47. #define Bit16_Get(%0,%1)                                                        \
  48.         (((DBITS_VAR=(%1)),DBITS_VAR&1)?(%0[(%1)/2]&0x0000FFFF):((%0[(%1)/2]>>>16)&0x0000FFFF))
  49.  
  50. stock Bit16_Set(bVar[], iSlot, bNum)
  51. {
  52.     if (iSlot & 1)
  53.         bVar[iSlot / 2] = (bVar[iSlot / 2] & 0xFFFF0000) | bNum;
  54.     else
  55.         bVar[iSlot / 2] = (bVar[iSlot / 2] & 0x0000FFFF) | (bNum << 16);
  56. }
  57.  
  58.  
  59. /*----------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement