]> git.stg.codes - stg.git/blob - include/stg/admin_conf.inc.h
Update travis dist.
[stg.git] / include / stg / admin_conf.inc.h
1  /*
2  $Revision: 1.1 $
3  $Date: 2010/09/10 01:45:24 $
4  $Author: faust $
5  */
6
7 #ifndef ADMIN_CONF_INC_H
8 #define ADMIN_CONF_INC_H
9
10 inline
11 uint32_t PRIV::ToInt() const
12 {
13 uint32_t p = (userStat   << 0)  |
14              (userConf   << 2)  |
15              (userCash   << 4)  |
16              (userPasswd << 6)  |
17              (userAddDel << 8)  |
18              (adminChg   << 10) |
19              (tariffChg  << 12) |
20              (serviceChg << 14) |
21              (corpChg    << 16);
22 return p;
23 }
24
25 inline
26 void PRIV::FromInt(uint32_t p)
27 {
28 userStat   = (p & 0x00000003) >> 0x00; // 1+2
29 userConf   = (p & 0x0000000C) >> 0x02; // 4+8
30 userCash   = (p & 0x00000030) >> 0x04; // 10+20
31 userPasswd = (p & 0x000000C0) >> 0x06; // 40+80
32 userAddDel = (p & 0x00000300) >> 0x08; // 100+200
33 adminChg   = (p & 0x00000C00) >> 0x0A; // 400+800
34 tariffChg  = (p & 0x00003000) >> 0x0C; // 1000+2000
35 serviceChg = (p & 0x0000C000) >> 0x0E; // 4000+8000
36 corpChg    = (p & 0x00030000) >> 0x10; // 10000+20000
37 }
38
39 #endif