saxbophone / arby

Arbitrary precision arithmetic in C++, even at compile-time
https://saxbophone.com/arby/
Mozilla Public License 2.0
8 stars 1 forks source link

cout operator: optimise for base-16 #110

Open saxbophone opened 2 years ago

saxbophone commented 2 years ago

There's an easy optimisation that can be made when printing Nat objects in base-16 (or indeed, any base that is exactly convertible from Nat::BASE –this is guaranteed to be a power of 2 that is a multiple of 8 (i.e. $2^{8n}$ for $n\in\mathbb{N}$):

Just print each digit in this base, in order. No base-conversion needed.

saxbophone commented 1 year ago

Blocked on #135