I’m looking for tutorials which talk about bitwise arithmetic operations, such as addition, subtraction, multiplication and division, maybe other operators more complicated like modular, inverse modular etc.
Actually I’m trying to implement a big number library for an embedded system on which there is no such library. So I’d like to learn how to handle signed big integers and how to do arithmetic calculations by manipulating bits. Now the only idea I have is to hold my big integer in a big uint8_t array with 1 bit reserved for sign. For example, if I need a 160-bit integer, then I need an array uint8_t num[21].
What are the basic knowledge that I have to learn ? I’ve searched on Google but I haven’t found many well explained tutorials. Or more exactly I don’t know what are the keywords that I have to use.
So I need your suggestions. If you know where I can find interesting tutorials, please post links here. PDFs, web pages, videos anything.
The topic you’re interested in is called arbitrary precision arithmetic.
Further information can be found here: http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
As far as “basic knowledge” is concerned: you will need to learn algorithms for performing arithmetic. you will also need a fairly competent understanding of dynamic memory management. I suspect your approach using arrays can be very clumsy and wasteful.