1
Septembers 2015-10-16 09:48:10 +08:00 via Android
|
2
c742435 2015-10-16 09:57:59 +08:00
byte = bits[0] * 128 + bits[1] * 64.....
|
3
zhujinliang 2015-10-16 10:17:13 +08:00
_byte = 0;
for i = 0; i < 8; i++ { _byte = _byte << 1 | bits[i]; } |
4
weiceshi 2015-10-16 11:22:10 +08:00
int i = 0;
byte b = (byte)bits.Select(x=>(x?1:0)<<i++).Sum(); |
5
adexbn 2015-10-16 11:37:58 +08:00
那啥,打字时瞄了一眼,把标题看成了有没有好的算命方法,对不起
|
6
hitmanx 2015-10-16 11:39:09 +08:00
@zhujinliang +1
|
7
adfreedom 2015-10-16 16:04:24 +08:00
@zhujinliang +1
|
8
zealot0630 2015-10-16 19:31:41 +08:00
std::bitset
|
9
ryd994 2015-10-16 20:25:19 +08:00 via Android
试试用 union{
bool[8]; unsigned char; } |