2019-07-13 20:42:00 +03:00
2020-06-04 14:23:42 +03:00
# 
2019-07-20 19:27:39 +03:00
2020-03-30 15:59:52 +03:00
**QtBigInt** - Arbitrary-sized integer class for C++ and build system qmake and cmake. Power by minigmp.
2019-07-20 19:27:39 +03:00
# Features
* No additional dependencies other than the standard library.
* Support for all arithmetic operators, which allows you to easily integrate the library into any of your algorithms.
* Based on the minigmp 6.1.2 library that provides high performance.
# Build
* git clone https://github.com/QuasarApp/QtBigInt.git
* cd QtBigInt
* qmake -r
* make -j8
* make test #(for testing)
# Include
2019-07-26 17:20:23 +03:00
## For qmake projects
2019-07-20 19:27:39 +03:00
* cd yourRepo
2020-03-30 15:59:52 +03:00
* git submodule add https://github.com/QuasarApp/QtBigInt.git # add the repository of QtBigInt into your repo like submodule
* git submodule update --init --recursive
* Include in your pro file the pri file of QtBigInt library
2021-02-01 15:04:50 +03:00
>>include($$PWD/QtBigInt/GMP.pri)
2021-04-09 14:36:37 +03:00
* Rebuild your project
2019-07-20 19:27:39 +03:00
2020-03-30 11:30:14 +03:00
## For cmake projects
2020-03-30 11:30:33 +03:00
#### The cmake build do not required Qt libraries.
2020-03-30 11:29:55 +03:00
* cd yourRepo
2020-03-30 15:59:52 +03:00
* git submodule add https://github.com/QuasarApp/QtBigInt.git # add the repository of QtBigInt into your repo like submodule
* git submodule update --init --recursive
2020-03-30 11:29:55 +03:00
* Disable Building of tests (because tests requariend qt libraries). Add befor incuding of QtBigInt next line :
>> set(WITHOUT_TESTS 1)
2021-02-01 15:04:50 +03:00
* Include in your CMakeLists.txt file the main CMakeLists.txt file of QtBigInt library
>> add_subdirectory(QtBigInt)
2021-04-09 14:36:37 +03:00
* Rebuild your project
2020-03-30 11:29:55 +03:00
``` cmake
set(WITHOUT_TESTS 1)
2021-02-01 15:04:50 +03:00
add_subdirectory(QtBigInt)
2021-02-01 15:09:40 +03:00
target_link_libraries(MyBinary PUBLIC QtBigInt)
2021-02-01 15:04:50 +03:00
```
### Note
By Default QtBigInt makes as a static library. If you want to create a shared library just add the BUILD_SHARED_LIBS into your main CMakeLists.txt file.
Example :
2021-02-01 15:05:20 +03:00
2021-02-01 15:05:36 +03:00
``` cmake
2021-02-01 15:04:50 +03:00
set(BUILD_SHARED_LIBS ON)
set(WITHOUT_TESTS 1)
add_subdirectory(QtBigInt)
2021-02-01 15:09:40 +03:00
target_link_libraries(MyBinary PUBLIC QtBigInt)
2020-03-30 11:29:55 +03:00
```
2021-02-01 15:04:50 +03:00
## For other build system
2019-07-20 19:27:39 +03:00
* cd yourRepo
2020-03-30 15:59:52 +03:00
* git submodule add https://github.com/QuasarApp/QtBigInt.git # add the repository of QtBigInt into your repo like submodule
* git submodule update --init --recursive
* Add the rule for build QtBigInt
2019-07-20 19:27:39 +03:00
* Add INCLUDEPATH and LIBS for your build system
2021-04-09 14:36:37 +03:00
* Rebuild your project
2019-07-20 19:27:39 +03:00
# Usage
Create objects of the BigInt class, and do what you got to do!
``` cpp
#include <bigint.h>
BigInt big1 = 1234567890, big2;
big2 = "9876543210123456789098765432101234567890";
std::cout << (big1 * big2 * 123456).getSring() << "\n";
// Output: 1505331490682966620443288524512589666204282352096057600
```