15 explicit n4(uint64_t v, uint64_t d = 1) : val(v), div(d) {}
16 std::ostream &print(std::ostream &os)
const {
18 if (val % div && val < div * 100) {
19 if ((v = val * 1000 + div / 2) < div * 1000) {
20 char ofill = os.fill(
'0');
21 os <<
'.' << std::setw(3) << v / div;
25 if ((v = val * 100 + div / 2) < div * 1000) {
26 char ofill = os.fill(
'0');
27 os << val / div <<
'.' << std::setw(2) << (v / div) % 100;
31 if ((v = val * 10 + div / 2) < div * 1000) {
32 os << val / div <<
'.' << (v / div) % 10;
36 v = (val + div / 2) / div;
38 os << std::setw(4) << v;
39 }
else if (v < UINT64_C(999500)) {
40 os << std::setw(3) << (v + 500) / 1000 <<
'K';
41 }
else if (v < UINT64_C(9950000)) {
42 v = (v + UINT64_C(50000)) / UINT64_C(100000);
43 os << v / 10 <<
'.' << v % 10 <<
'M';
44 }
else if (v < UINT64_C(999500000)) {
45 os << std::setw(3) << (v + UINT64_C(500000)) / UINT64_C(1000000) <<
'M';
46 }
else if (v < UINT64_C(9950000000)) {
47 v = (v + UINT64_C(50000000)) / UINT64_C(100000000);
48 os << v / 10 <<
'.' << v % 10 <<
'G';
49 }
else if (v < UINT64_C(999500000000)) {
50 os << std::setw(3) << (v + UINT64_C(500000000)) / UINT64_C(1000000000) <<
'G';
51 }
else if (v < UINT64_C(9950000000000)) {
52 v = (v + UINT64_C(50000000000)) / UINT64_C(100000000000);
53 os << v / 10 <<
'.' << v % 10 <<
'T';
55 os << std::setw(3) << (v + UINT64_C(500000000000)) / UINT64_C(1000000000000) <<
'T';
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24