mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-05 01:26:20 +00:00
Better logging in the term code
This commit is contained in:
parent
5082b1677c
commit
9cca908bff
@ -20,12 +20,8 @@ import java.nio.ByteBuffer;
|
||||
*/
|
||||
public abstract class TermMethods {
|
||||
private static int getHighestBit(int group) {
|
||||
var bit = 0;
|
||||
while (group > 0) {
|
||||
group >>= 1;
|
||||
bit++;
|
||||
}
|
||||
return bit;
|
||||
// Equivalent to log2(group) - 1.
|
||||
return 32 - Integer.numberOfLeadingZeros(group);
|
||||
}
|
||||
|
||||
public abstract Terminal getTerminal() throws LuaException;
|
||||
|
@ -367,8 +367,7 @@ colors.toBlit(colors.red)
|
||||
]]
|
||||
function toBlit(color)
|
||||
expect(1, color, "number")
|
||||
return color_hex_lookup[color] or
|
||||
string.format("%x", math.floor(math.log(color) / math.log(2)))
|
||||
return color_hex_lookup[color] or string.format("%x", math.floor(math.log(color, 2)))
|
||||
end
|
||||
|
||||
--[[- Converts the given paint/blit hex character (0-9a-f) to a color.
|
||||
|
Loading…
Reference in New Issue
Block a user