bcm-v4

[Specification

Calc Log (u32 power)

  1. Call Find MS Bit with power as argument. Save result as tmp

  2. Set tmp1 to (1 << tmp)

  3. Set tmp2 to 2 * tmp1
  4. Set diff1 to power - tmp1
  5. Set diff2 to tmp2 - power
  6. If diff1 < diff2

    1. Return tmp
  7. Otherwise
    1. Return tmp + 1

Exported/Archived from the wiki to HTML on 2016-10-27