zoukankan      html  css  js  c++  java
  • 上下舍入至2的幂次

          4 int clp2(unsigned int n)                                                                                    
          5 {
          6     --n;
          7     n = n | (n >> 1);
          8     n = n | (n >> 2);
          9     n = n | (n >> 4);
         10     n = n | (n >> 8);
         11     n = n | (n >> 16);
         12     return n + 1;
         13 }

    unsigned flp2 (unsigned x)

    {

      x = x | (x >> 1)

           x = x | (x >> 2)

           x = x | (x >> 4);

           x = x | (x >> 8);

           x = x | (x >> 16);

           return x - (x >> 1);

    }

  • 相关阅读:
    前端面试题
    js collection
    javascript变量声明提升(hoisting)
    css3动画
    神奇的meta
    wap站bug小结
    前端collection
    js拾遗
    prototype之初印象
    自定义scrollBottom的值
  • 原文地址:https://www.cnblogs.com/openix/p/2687777.html
Copyright © 2011-2022 走看看