What are the libraries of large numbers in C. A sub-instruction 256 & 512 & 1024 bit numbers is needed. Thank.

2 answers 2

Google by the words "binint c" gives a bunch-heap. But you can start with the classics - GMP . Even on wikipedia there is an example .

Nearby, on SO there are examples of how people write their own .

  • one
    it is worth making a reservation that gmp is nailed to gcc with nails ... and there is a list of alternatives on the wiki. - Fat-Zer 7:43 pm
  • I think that 1024 bit can be done on the knee - KoVadim February
  • It’s not really a big difference to write for 256, 1k or 16k bits - in general, but what to write and what efficiency requirements there are, for example, add-multiply to do on the knee is not difficult, but I would divide by I wouldn’t write my own vigor until I cherish it at all ... - Fat-Zer

Somehow I also needed long arithmetic. But it was impossible to use GMP, since long arithmetic was needed for microcontrollers without an operating system and a heap. I had to write my own library of C ++ templates for working with long integers. Here is the link:

https://sourceforge.net/projects/muntl/?source=frontpage&position=5

There in the archive there is a description in Russian. But this is not C, but C ++ templates.