mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
AK: Add binary and octal mode formatting for FixedPoint
This commit is contained in:
parent
352480338e
commit
2caf68fd03
3 changed files with 23 additions and 6 deletions
|
@ -419,16 +419,21 @@ struct Formatter<FixedPoint<precision, Underlying>> : StandardFormatter {
|
|||
ErrorOr<void> format(FormatBuilder& builder, FixedPoint<precision, Underlying> value)
|
||||
{
|
||||
u8 base;
|
||||
bool upper_case;
|
||||
bool upper_case = false;
|
||||
if (m_mode == Mode::Default || m_mode == Mode::FixedPoint) {
|
||||
base = 10;
|
||||
upper_case = false;
|
||||
} else if (m_mode == Mode::Hexfloat) {
|
||||
base = 16;
|
||||
upper_case = false;
|
||||
} else if (m_mode == Mode::HexfloatUppercase) {
|
||||
base = 16;
|
||||
upper_case = true;
|
||||
} else if (m_mode == Mode::Binary) {
|
||||
base = 2;
|
||||
} else if (m_mode == Mode::BinaryUppercase) {
|
||||
base = 2;
|
||||
upper_case = true;
|
||||
} else if (m_mode == Mode::Octal) {
|
||||
base = 8;
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue