Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The radix 2^51 trick (chosenplaintext.ca)
51 points by shkhuz on Nov 22, 2022 | hide | past | favorite | 6 comments


I believe the general name of this trick is "carry save addition".

https://en.wikipedia.org/wiki/Carry-save_adder


This article may give some reassurance to people worried about RISC-V not having an add with carry instruction; it's not quite as useful as it appears at first sight.


There are many such tricks in the book Hacker's Delight. It's basically an encyclopedia of tricks.


The sort of operation familiar to Z80 programmers back in the day.


I don't think that's true.

ADC (add with carry) was just fine on the 8080, Z80, 6502, 6800 generation sicne memory was the same speed as CPU and everything executed in a single cycle. I mean, you even had instructions like DAA (Decimal Adjust Accumulator) which were just fine for doing BCD arithmetic.

You only benefit from tricks like these when you get wide dispatch, speculative execution processors.


Well-written, thanks!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: