1
0
mirror of https://github.com/chylex/Brotli-Builder.git synced 2025-08-30 04:53:08 +02:00
Files
.github
BrotliBuilder
BrotliCalc
BrotliImpl
BrotliLib
Brotli
Collections
Markers
Numbers
AlphabetSize.cs
IntRange.cs
Log2.cs
Serialization
BrotliLib.csproj
LICENSE-BROTLI.txt
Paper
UnitTests
.gitignore
BrotliBuilder.sln
LICENSE
README.md

17 lines
434 B
C#

namespace BrotliLib.Numbers{
public static class Log2{
/**
* Calculates log2 of an integer. Returns the result rounded down to the nearest integer, or 0 if the provided value is <= 0.
*/
public static byte Floor(int value){
byte result = 0;
while((value >>= 1) > 0){
++result;
}
return result;
}
}
}