diff --git a/src/algorithms/math/bits/__test__/fullAdder.test.js b/src/algorithms/math/bits/__test__/fullAdder.test.js index e21a07d9..529187dc 100644 --- a/src/algorithms/math/bits/__test__/fullAdder.test.js +++ b/src/algorithms/math/bits/__test__/fullAdder.test.js @@ -1,6 +1,6 @@ import fullAdder from '../fullAdder'; -describe('Full adder', () => { +describe('fullAdder', () => { it('should add up two numbers', () => { expect(fullAdder(0, 0)).toBe(0); expect(fullAdder(2, 0)).toBe(2); diff --git a/src/algorithms/math/bits/fullAdder.js b/src/algorithms/math/bits/fullAdder.js index f97f4e5f..37d74bb9 100644 --- a/src/algorithms/math/bits/fullAdder.js +++ b/src/algorithms/math/bits/fullAdder.js @@ -3,7 +3,7 @@ import getBit from './getBit'; /** * Add two numbers using only binary operators. * - * This is an implementation of full adders logic circut. + * This is an implementation of full adders logic circuit. * https://en.wikipedia.org/wiki/Adder_(electronics) * Inspired by: https://www.youtube.com/watch?v=wvJc9CZcvBc * @@ -65,5 +65,6 @@ export default function fullAdder(a, b) { // Set ith least significant bit of the result to bitSum. result |= bitSum << i; } + return result; }