随笔

enum SM_DBModifyOpt
{
    eSM_DB_Add,
    eSM_DB_Update,
    eSM_DB_Del,
};

char c = {0};//111---删除|更新|增加

bool IsOpt(int eOpt, char c)
{
    return (c >> eOpt  & 1) == 1;
}

void SetOpt(int eOpt, char& c)
{
    c |= (1 << eOpt);
}
int main()
{
    //SetOpt(eSM_DB_Add, c);
    SetOpt(eSM_DB_Update, c);
    SetOpt(eSM_DB_Del, c);
    bool b = IsOpt(eSM_DB_Add, c);
    b = IsOpt(eSM_DB_Update, c);
    b = IsOpt(eSM_DB_Del, c);
    return 0;
}

 

posted @ 2014-12-30 23:59  zzyoucan  阅读(131)  评论(0编辑  收藏  举报