Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <msp430.h>
- signed long x=0x0005;
- int y,i,n;
- void main(void)
- {
- y=~x;
- i=y+1;
- }
- #define MASK 0x80000000
- // Return value of "0" means the bit wasn't set, "1" means the bit was.
- // You can check as many bits as you want with this call.
- int ApplyMask(int number) {
- return number & MASK;
- }
- int CheckBit(int number, int bitIndex) {
- return number & (1 << bitIndex);
- }
- bool isSetBit (signed long number, int bit)
- {
- assert ((bit >= 0) && (bit < (sizeof (signed long) * 8)));
- return (number & (((signed long) 1) << bit)) != 0;
- }
- if (isSetBit (y, sizeof (y) * 8 - 1))
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement