Explain the following C++ method

前端 未结 4 970
日久生厌
日久生厌 2021-01-23 18:06
#define XL     33           
#define OR      113          
#define NOR     313     
#define TN     344  

int to_bits(int critn,char *mask)
{
       unsigned int x;
             


        
4条回答
  •  长情又很酷
    2021-01-23 18:20

      *mask = (char)(0x80 >> (x % 8));  
    

    The value x is masked so that only the lower three bits remain. The value 0x80 is shifted to right by the remaining number. The result is assigned to the value where mask points to.

       return (int)(x >> 3);    // fast divide by 8     
    

    x is divided by eight. The result is the reutrn value of the method.

提交回复
热议问题