Get minimum bytes needed for a number in c#
I have this method in python that gives me the minimum bytes needed for a number
for a number like 122 it will return 1, and for like 257 it will return 2, so on and so forth
5 Replies
i want to figure out a way to impliment it in python
i was doing it like this
but i want to go as far as 8, and i dont want a super long if statement
Using a logarithm might be helpful
ero
REPL Result: Success
Console Output
Compile: 457.477ms | Execution: 29.926ms | React with ❌ to remove this embed.
Courtesy of #allow-unsafe-blocks
oh wait thank you wtf. thats actually very useful