最快取一个整数最高位的方法

 

int64_t GetHighest (int64_t num)    //原谅我的渣英文
{
  if(num < 0){
        num *= -1;    
    }

    while (num >= 10) {
        num /= 10;
    }
    return num;
}

 

 

 

方法来源

posted @ 2015-02-23 22:30  wu_overflow  阅读(801)  评论(0编辑  收藏  举报