You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/algorithms/math/bits/README.md
+16-10
Original file line number
Diff line number
Diff line change
@@ -91,24 +91,30 @@ inverting all of the bits of the number and adding 1 to it.
91
91
92
92
> See `switchSign` function for further details.
93
93
94
-
#### Multiply
94
+
#### Multiply Two Numbers
95
95
96
-
This method multiplies two numbers(integer) using bitwise operators. This method is based on that "Every number can be denoted as the sum of powers of 2".
96
+
This method multiplies two integer numbers using bitwise operators.
97
+
This method is based on that "Every number can be denoted as the sum of powers of 2".
97
98
98
-
```
99
-
Let us take two numbers number1 and number2.
99
+
The main idea of bitwise multiplication is that every number may be split
100
+
to the sum of powers of two:
101
+
102
+
I.e.
100
103
101
-
number1 * number2 = number1 * (Representation in Base 2)
104
+
```text
105
+
19 = 2^4 + 2^1 + 2^0
106
+
```
102
107
103
-
Let us take number2 = 8 = 0b 1000
108
+
Then multiplying number `x` by `19` is equivalent of:
0 commit comments