WideIntProofOfConcept icon indicating copy to clipboard operation
WideIntProofOfConcept copied to clipboard

Couple of questions on port and long div

Open ckormanyos opened this issue 4 years ago • 2 comments

I notice you use pure shift-and-add for div. Did you investigate any other typed of long div/rem algorithms, such as Knuth's or similar?

Did you port to ARM? What experiences have you made on embedded systems?

I like the look of your LIB. It's simple, practical. Around the same time, I was looking for a bare bones impl for big unsigned ints. For similar reasons, I came up with wide-integer. That thing has been used on ARM, Renesas, MICROCHIP, numerous micros and PCs. You might like some parts of it.

ckormanyos avatar Apr 05 '21 11:04 ckormanyos

I notice you use pure shift-and-add for div. Did you investigate any other typed of long div/rem algorithms, such as Knuth's or similar?

No, because I am lazy. :) A long time ago I bookmarked Ricky Han's code from https://bugs.llvm.org/show_bug.cgi?id=45649#c7 with the intent of trying it out at some point. I have not tried to implement anything else.

Did you port to ARM? What experiences have you made on embedded systems?

Not at all, and none. I never really intended this as a "production-quality" library; my original intent was more like Stepanov's "abstraction penalty" benchmark, to prove (or disprove) that mainstream compiler optimizers were capable of generating optimal wide-int codegen from relatively ordinary and portable C++ code — and also as a response to Boost.Multiprecision, to show that simple template code can vastly outperform complicated Boost-style code. (At some point my sense of purpose got corrupted into trying to produce optimal codegen regardless of portability, though. The technical term for this is apparently "surrogation," and its lure is hard to resist.)

For a bit more background, see https://quuxplusone.github.io/blog/2020/02/13/wide-integer-proof-of-concept/ .

Quuxplusone avatar Apr 05 '21 14:04 Quuxplusone

Thanks for explaining.

I'm fascinated by and work on both Boost.Multiprecision as well as some other hand-optimized, yet portable back ends for both workstation as well as embedded bare-metal systems, so I follow these discussions as best and closely as possible.

ckormanyos avatar Apr 05 '21 21:04 ckormanyos