Hi all,
I am trying to write a C code to multiply 2 byte arrays and then divide the answer by 200 . any ideas how to do that ?
thank you
Hi all,
I am trying to write a C code to multiply 2 byte arrays and then divide the answer by 200 . any ideas how to do that ?
thank you
That depends entirely what you mean by "multiplying two byte arrays". Multiplying one byte by one byte? Multiplying two-bytes-at-a-time by two-bytes-at-a-time? What about overflow?
In any event, some sort of loop seems indicated.
thank you very much ... the two arrays are the same , i just need to square one and then divide the answer by 200
You should probably cast to int before multiplying. Otherwise you risk overflow even when your result is less than the max value of a byte.
Last edited by King Mir; 07-12-2011 at 04:36 PM.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
Are the array's elements independent of each other?
Yes => Do what @tabstop told you.
No => Forget it! Use an arbitrary-sized arithmetics library instead.
Devoted my life to programming...