From 5c12f45ddc56fe8f0b2d8a83f92c5ab13e4323a5 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Tue, 2 Apr 2019 21:57:00 -0700 Subject: [PATCH] Minor typo fix. --- src/algorithms/math/bits/__test__/fullAdder.test.js | 2 +- src/algorithms/math/bits/fullAdder.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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; }