/Ready-Set-Boole-

Summary: Discover the way computers work mathematically

Primary LanguagePython

Exercise 00 - Adder :


III.0.1 Goal

You must write a function that takes as parameters two natural numbers a and b and returns one natural number that equals a + b. However the only operations you’re allowed to use are:

• & (bitwise AND)

• | (bitwise OR)

• ^ (bitwise XOR)

• << (left shift)

• >> (right shift)

• = (assignment)

• ==, !=, <, >, <=, >= (comparison operators)

The incrementation operator (++ or += 1) is allowed only to increment the index of a loop and must not be used to compute the result itself. You must also turn in a main function in order to test your function, ready to be compiled (if necessary) and run. III.0.2 Instructions The prototype of the function to write is the following: fn adder(a: u32, b: u32) -> u32;

Video for adder logic