I am making a simulator, which simulates the method of multiplication of a processor. The thing is first I have to convert the decimal form to binary, each bit of binary representation is stored at separate location in an array. Now the multiplication of two binary numbers, stored in arrays as mentioned above is very complex and also very memory consuming.
because I have to follow this method;
1000
x
1110
`0000`
`1000`
`1000`
`1000`
= 1110000
I know that I can easily do this by multiplying decimals forms together and then convert them to binary but unfortunately that's not required here.
I was thinking if there is a way to store the binary number stored in array as a single integer containing binary no. Or any other easy way for multiplying binary bits stored in array. For Example:
a[0]=1,a[1]=1, .... ,a[32]=0
so I want the integer variable to contain
int x=110....0
Is there a way to do this?
Regards