c状态位

/*位运算,存储*/
int tl_bintree(int t){
    int x = 0,a=t;
    while(a!=1){
        a=a/2;    x++;
    }
    return x;
}
int ex_getState( struct EX* e,int t){
    return (e->_st & t)>>tl_bintree(t);
}

void ex_enable(struct EX* e,int t){
    e->_st = e->_st | t;
}

void ex_disable( struct EX* e,int t ){
    e->_st = (~t)&e->_st; 
}

 

posted @ 2017-08-25 10:13  泥潭里的金鱼  阅读(257)  评论(0编辑  收藏  举报