Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- void setZero(int* num){
- *num = 0;
- }
- void swap(int* a, int* b){
- int temp = *a;
- *a = *b;
- *b = temp;
- }
- void setBit(uint32_t* mask, int pos){
- *mask |= (1 << pos);
- }
- void clearBit(uint32_t* mask, int pos){
- *mask &= ~(1 << pos);
- }
- void changeBit(uint32_t* mask, int pos){
- *mask ^= (1 << pos);
- }
- int checkBit(uint32_t mask, int pos){
- return !!(mask & (1 << pos));
- }
- int main(){
- uint32_t mask = 0;
- setBit(&mask, 2);
- clearBit(&mask, 2);
- printf("%d\n", mask);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement