时时商务社区

标题: PHP中使用BigMap实例 [打印本页]

作者: yj1281    时间: 2018-2-14 05:47

            
>SHIFT 这里相当于 intval($i /32) ;
                 // $i & $this->mask 这里相当于 $i % $this->mask ,取余
                 @$this->bitArray[$i >> $this->shift] &= ~(1mask));
        }

         /**
         $i 对应的数致1
         */
         function setbit($i){
                 @$this->bitArray[$i >> $this->shift] |= (1mask));
        }

//test 测试所在的bit为是否为1
function testbit($i){
                return $this->bitArray[$i >> $this->shift] & (1mask));
        }          
}
$oBig = new bigMap() ;
$oBig->setbit(30) ;
var_dump($oBig->testbit(2)) ;
var_dump($oBig->bitArray) ;
echo decbin($oBig->bitArray[0]),"
";

            
            
        




欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2