Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <msp430.h>
  2. signed long x=0x0005;
  3. int y,i,n;
  4. void main(void)
  5. {
  6. y=~x;
  7. i=y+1;
  8.  
  9. }
  10.  
  11. #define MASK 0x80000000
  12.  
  13. // Return value of "0" means the bit wasn't set, "1" means the bit was.
  14. // You can check as many bits as you want with this call.
  15. int ApplyMask(int number) {
  16. return number & MASK;
  17. }
  18.  
  19. int CheckBit(int number, int bitIndex) {
  20. return number & (1 << bitIndex);
  21. }
  22.  
  23. bool isSetBit (signed long number, int bit)
  24. {
  25. assert ((bit >= 0) && (bit < (sizeof (signed long) * 8)));
  26. return (number & (((signed long) 1) << bit)) != 0;
  27. }
  28.  
  29. if (isSetBit (y, sizeof (y) * 8 - 1))
  30. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement