using System;
public class Demo {
public static void Main() {
uint val = 12; // 1100 in binary
uint res = (uint) Math.Log(val, 2.0) + 1;
// 1100 has 4 bits
Console.WriteLine("Total bits: " + res);
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/265922.html