mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-13 02:40:28 +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 {
|
public abstract class TermMethods {
|
||||||
private static int getHighestBit(int group) {
|
private static int getHighestBit(int group) {
|
||||||
var bit = 0;
|
// Equivalent to log2(group) - 1.
|
||||||
while (group > 0) {
|
return 32 - Integer.numberOfLeadingZeros(group);
|
||||||
group >>= 1;
|
|
||||||
bit++;
|
|
||||||
}
|
|
||||||
return bit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Terminal getTerminal() throws LuaException;
|
public abstract Terminal getTerminal() throws LuaException;
|
||||||
|
@ -367,8 +367,7 @@ colors.toBlit(colors.red)
|
|||||||
]]
|
]]
|
||||||
function toBlit(color)
|
function toBlit(color)
|
||||||
expect(1, color, "number")
|
expect(1, color, "number")
|
||||||
return color_hex_lookup[color] or
|
return color_hex_lookup[color] or string.format("%x", math.floor(math.log(color, 2)))
|
||||||
string.format("%x", math.floor(math.log(color) / math.log(2)))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[- Converts the given paint/blit hex character (0-9a-f) to a color.
|
--[[- Converts the given paint/blit hex character (0-9a-f) to a color.
|
||||||
|
Loading…
Reference in New Issue
Block a user