Minor typo fix.

This commit is contained in:
Oleksii Trekhleb 2019-04-02 21:57:00 -07:00
parent b1c36a85cf
commit 5c12f45ddc
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import fullAdder from '../fullAdder'; import fullAdder from '../fullAdder';
describe('Full adder', () => { describe('fullAdder', () => {
it('should add up two numbers', () => { it('should add up two numbers', () => {
expect(fullAdder(0, 0)).toBe(0); expect(fullAdder(0, 0)).toBe(0);
expect(fullAdder(2, 0)).toBe(2); expect(fullAdder(2, 0)).toBe(2);

View File

@ -3,7 +3,7 @@ import getBit from './getBit';
/** /**
* Add two numbers using only binary operators. * 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) * https://en.wikipedia.org/wiki/Adder_(electronics)
* Inspired by: https://www.youtube.com/watch?v=wvJc9CZcvBc * 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. // Set ith least significant bit of the result to bitSum.
result |= bitSum << i; result |= bitSum << i;
} }
return result; return result;
} }