08:23
Input and output are little-endian (i.e. least significant bit first). Can handle numbers of any size. Not really golfed.
Takes the two input numbers from
?
and feeds them into two loops, where we split off the first bit of each on each iteration. Two collectors are necessary to prevent the code from looping forever on long numbers. The single bit from each number exits from the >
.
This is the first half-adder, with extra logic to feed a
0
back into it if it's only given one input. The carry bit exits from the bottom rightmost >
and the sum bit from the top rightmost >
.
This is the second half-adder, much simpler because it doesn't have the feedback logic. It doesn't need it because its inputs (one from the first half-adder, one from the previous step's carry bit) are guaranteed to be present. The carry bit exits from the bottom right
v
and the sum bit from the top right >
, where it goes into !
and is printed. « first day (541 days earlier) ← previous day next day → last day (855 days later) »
Transcript for
Feb15
Feb '1716
Feb21
Esoteric Programming Languages
A room for discussing, creating, using, golfing and discoverin...