titant3k

masker - out1.h

Nov 17th, 2020
388
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef unsigned int tm_engine;
  2.  
  3. #define MASK_engine_eye 255
  4. #define MASK_engine_leg 16128
  5. #define MASK_engine_arm 114688
  6.  
  7. #define NBITS_engine_eye    8
  8. #define NBITS_engine_leg    6
  9. #define NBITS_engine_arm    3
  10.  
  11. #define MAXV_engine_eye 255
  12. #define MAXV_engine_leg 63
  13. #define MAXV_engine_arm 7
  14.  
  15. #define SHIFT_engine_eye    0
  16. #define SHIFT_engine_leg    8
  17. #define SHIFT_engine_arm    14
  18.  
  19. #define MREAD_engine_eye(x)     (((x)&(MASK_engine_eye))>>(SHIFT_engine_eye))
  20. #define MREAD_engine_leg(x)     (((x)&(MASK_engine_leg))>>(SHIFT_engine_leg))
  21. #define MREAD_engine_arm(x)     (((x)&(MASK_engine_arm))>>(SHIFT_engine_arm))
  22.  
  23. #define MWRITE_engine_eye(dest,val)     ((dest))=((((dest))&(~(MASK_engine_eye)))|(val<<SHIFT_engine_eye))
  24. #define MWRITE_engine_leg(dest,val)     ((dest))=((((dest))&(~(MASK_engine_leg)))|(val<<SHIFT_engine_leg))
  25. #define MWRITE_engine_arm(dest,val)     ((dest))=((((dest))&(~(MASK_engine_arm)))|(val<<SHIFT_engine_arm))
  26.  
  27. unsigned char CMWRITE_engine_eye(tm_engine dest, tm_engine val)
  28.  {
  29.   if(val>MAXV_engine_eye) { printf("[ERR] out of limits in engine_eye\n"); return 0; }
  30.   MWRITE_engine_eye(dest,val); return 1;
  31.  }
  32. unsigned char CMWRITE_engine_leg(tm_engine dest, tm_engine val)
  33.  {
  34.   if(val>MAXV_engine_leg) { printf("[ERR] out of limits in engine_leg\n"); return 0; }
  35.   MWRITE_engine_leg(dest,val); return 1;
  36.  }
  37. unsigned char CMWRITE_engine_arm(tm_engine dest, tm_engine val)
  38.  {
  39.   if(val>MAXV_engine_arm) { printf("[ERR] out of limits in engine_arm\n"); return 0; }
  40.   MWRITE_engine_arm(dest,val); return 1;
  41.  }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×