|
|
|
|
|
by brucehoult
38 days ago
|
|
The size of a register is not the largest value you can conveniently count on a computer. You can use multiple registers. Old computers often had a "carry flag" specifically to make this easier e.g.on Arm: add r0,r0,#1
adc r1,r1,#0
But even on RISC-V, often criticised for not having a carry flag, it's not hard: addi a0,a0,1
sltiu t1,a0,1 # set to 1 if a0 wrapped back to 0
add a1,a1,t1
|
|