Browse Source

addition for all unsigned integer (modulo UNIT_MAX)

master
Dennis Sperzel 11 months ago
parent
commit
faee79b2bd
  1. 2
      src/addition.c

2
src/addition.c

@ -12,7 +12,7 @@ unsigned int addition(num number1, num number2) {
num sum[1] = {0}; num sum[1] = {0};
num nextcarry[1] = {0}; num nextcarry[1] = {0};
for (int i = 0; i < 2; i++)
for (int i = 0; i < 8 * sizeof(num); i++)
{ {
full_adder(sum, nextcarry, number1, number2, nextcarry[0]); full_adder(sum, nextcarry, number1, number2, nextcarry[0]);
result ^= (sum[0] << i); result ^= (sum[0] << i);

Loading…
Cancel
Save