]> git.stg.codes - stg.git/blob - include/admin_conf.inc.h
Добавление исходников
[stg.git] / include / 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 uint16_t PRIV::ToInt() const
12 {
13 uint16_t p = (userStat   << 0)  |
14              (userConf   << 2)  |
15              (userCash   << 4)  |
16              (userPasswd << 6)  |
17              (userAddDel << 8)  |
18              (adminChg   << 10) |
19              (tariffChg  << 12);
20 return p;
21 }
22
23 inline
24 void PRIV::FromInt(uint16_t p)
25 {
26 userStat   = (p & 0x0003) >> 0x00; // 1+2
27 userConf   = (p & 0x000C) >> 0x02; // 4+8
28 userCash   = (p & 0x0030) >> 0x04; // 10+20
29 userPasswd = (p & 0x00C0) >> 0x06; // 40+80
30 userAddDel = (p & 0x0300) >> 0x08; // 100+200
31 adminChg   = (p & 0x0C00) >> 0x0A; // 400+800
32 tariffChg  = (p & 0x3000) >> 0x0C; // 1000+2000
33 }
34
35 #endif