forked from QuasarApp/QtBigInt
Compare commits
No commits in common. "main" and "fixWarnings" have entirely different histories.
main
...
fixWarning
16
.gitignore
vendored
16
.gitignore
vendored
@ -4,8 +4,6 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
*Testing/*
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
@ -60,17 +58,3 @@ tests/QtBigIntTests
|
||||
*moc_*
|
||||
*.moc
|
||||
tests/target_wrapper.sh
|
||||
|
||||
#cmake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
*_autogen
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "CMake"]
|
||||
path = CMake
|
||||
url = https://github.com/QuasarApp/CMake.git
|
1
CMake
1
CMake
@ -1 +0,0 @@
|
||||
Subproject commit 5e0fc2b92801eff4fb490f8db1cc2bd28e8d94e8
|
@ -1,53 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(QtBigint LANGUAGES CXX)
|
||||
if(TARGET ${PROJECT_NAME})
|
||||
message("The ${PROJECT_NAME} arledy included in main Project")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CMake/QuasarApp.cmake)
|
||||
include(CMake/Version.cmake)
|
||||
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core QUIET)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core QUIET)
|
||||
|
||||
if (NOT DEFINED BIGINT_TESTS)
|
||||
set(BIGINT_TESTS ON)
|
||||
|
||||
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
|
||||
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
|
||||
set(BIGINT_TESTS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ANDROID)
|
||||
set(BIGINT_TESTS OFF)
|
||||
endif()
|
||||
|
||||
if (NOT QT_VERSION_MAJOR)
|
||||
set(BIGINT_TESTS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if (BIGINT_TESTS)
|
||||
add_subdirectory(tests)
|
||||
else()
|
||||
message("The ${PROJECT_NAME} tests is disabled.")
|
||||
endif()
|
||||
|
||||
|
||||
initAll()
|
||||
|
||||
addDoc(${PROJECT_NAME}Docs ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf)
|
||||
|
2
GMP.pri
2
GMP.pri
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
11
GMP.pro
11
GMP.pro
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
@ -11,7 +11,12 @@ CONFIG += ordered
|
||||
SUBDIRS += \
|
||||
src
|
||||
|
||||
include($$PWD/tests/test.pri)
|
||||
|
||||
src.file = src/GMP.pro
|
||||
|
||||
QMAKE_EXTRA_TARGETS += \
|
||||
test
|
||||
gcc {
|
||||
SUBDIRS += tests
|
||||
tests.file = tests/tests.pro
|
||||
|
||||
}
|
||||
|
21
LICENSE
21
LICENSE
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 QuasarApp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
83
README.md
83
README.md
@ -1,83 +1,2 @@
|
||||
|
||||
# 
|
||||
|
||||
**QtBigInt** - Arbitrary-sized integer class for C++ and build system qmake and cmake. Power by minigmp.
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
## For qmake projects
|
||||
|
||||
* cd yourRepo
|
||||
* 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
|
||||
>>include($$PWD/QtBigInt/GMP.pri)
|
||||
* Rebuild your project
|
||||
|
||||
## For cmake projects
|
||||
#### The cmake build do not required Qt libraries.
|
||||
|
||||
* cd yourRepo
|
||||
* git submodule add https://github.com/QuasarApp/QtBigInt.git # add the repository of QtBigInt into your repo like submodule
|
||||
* git submodule update --init --recursive
|
||||
* Disable Building of tests (because tests requariend qt libraries). Add befor incuding of QtBigInt next line :
|
||||
>> set(WITHOUT_TESTS 1)
|
||||
* Include in your CMakeLists.txt file the main CMakeLists.txt file of QtBigInt library
|
||||
>> add_subdirectory(QtBigInt)
|
||||
* Rebuild your project
|
||||
|
||||
``` cmake
|
||||
set(WITHOUT_TESTS 1)
|
||||
add_subdirectory(QtBigInt)
|
||||
target_link_libraries(MyBinary PUBLIC QtBigInt)
|
||||
```
|
||||
|
||||
### 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 :
|
||||
|
||||
``` cmake
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
set(WITHOUT_TESTS 1)
|
||||
add_subdirectory(QtBigInt)
|
||||
target_link_libraries(MyBinary PUBLIC QtBigInt)
|
||||
|
||||
```
|
||||
|
||||
## For other build system
|
||||
|
||||
* cd yourRepo
|
||||
* 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
|
||||
* Add INCLUDEPATH and LIBS for your build system
|
||||
* Rebuild your project
|
||||
|
||||
|
||||
# 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
|
||||
```
|
||||
# QtBigInt
|
||||
|
324
doxygen.conf
324
doxygen.conf
@ -1,324 +0,0 @@
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = QtBigInt
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = docs
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
QT_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
TCL_SUBST =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 0
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE = CMake/DoxyStyle/DoxygenLayout.xml
|
||||
CITE_BIB_FILES =
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
INPUT = src \
|
||||
README.md
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.idl \
|
||||
*.ddl \
|
||||
*.odl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.d \
|
||||
*.php \
|
||||
*.php4 \
|
||||
*.php5 \
|
||||
*.phtml \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py \
|
||||
*.pyw \
|
||||
*.f90 \
|
||||
*.f95 \
|
||||
*.f03 \
|
||||
*.f08 \
|
||||
*.f \
|
||||
*.for \
|
||||
*.tcl \
|
||||
*.vhd \
|
||||
*.vhdl \
|
||||
*.ucf \
|
||||
*.qsf
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = ./CMake \
|
||||
./CMakeFiles
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ./QtBigInt/res
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE = README.md
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
CLANG_OPTIONS =
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = .
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET = CMake/DoxyStyle/doxygenStyles.css
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = QuasarApp
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = QuasarApp.QtBigInt
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = YES
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = YES
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_SOURCE_CODE = NO
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_PROGRAMLISTING = YES
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = YES
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
CALLER_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = YES
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
BIN
res/png/QtBigIntLogo.png
Normal file
BIN
res/png/QtBigIntLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
BIN
res/png/QtBigIntLogo2.png
Normal file
BIN
res/png/QtBigIntLogo2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.5 MiB |
Binary file not shown.
Before Width: | Height: | Size: 382 KiB |
Binary file not shown.
Before Width: | Height: | Size: 954 KiB |
Binary file not shown.
Before Width: | Height: | Size: 135 KiB |
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(CURRENT_PROJECT ${PROJECT_NAME})
|
||||
|
||||
project(QtBigint LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
file(GLOB SOURCE_CPP
|
||||
"*.cpp"
|
||||
"mini-gmp.c"
|
||||
)
|
||||
set_source_files_properties(mini-gmp.c PROPERTIES LANGUAGE CXX )
|
||||
|
||||
add_library(${CURRENT_PROJECT} ${SOURCE_CPP})
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
setVersion(6 1 2)
|
19
src/GMP.pri
19
src/GMP.pri
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
@ -14,21 +14,8 @@ CONFIG(release, debug|release): {
|
||||
} else {
|
||||
MINIGMP_LIBRARY_OUTPUT_DIR="$$PWD/build/debug"
|
||||
}
|
||||
unix:LIBS += -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt
|
||||
|
||||
lessThan (QT_MINOR_VERSION, 14): {
|
||||
unix: LIBS += -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt
|
||||
win32: LIBS += -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt6
|
||||
|
||||
} else {
|
||||
LIBTENP = -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt
|
||||
android: LIBTENP = -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt_$$QT_ARCH
|
||||
win32: LIBTENP = -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt6
|
||||
|
||||
LIBS += $$LIBTENP
|
||||
}
|
||||
|
||||
message(LIBS = $$LIBS)
|
||||
|
||||
win32:LIBS += -L$$MINIGMP_LIBRARY_OUTPUT_DIR -lQtBigInt
|
||||
|
||||
include(GMPIncudePah.pri)
|
||||
include(ccache.pri);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
QT -= core gui
|
||||
|
||||
TARGET = MiniGMP
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += MINIGMP_LIBRARY
|
||||
@ -15,6 +16,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
TARGET = QtBigInt
|
||||
|
||||
CONFIG += static
|
||||
VERSION = 6.1.2
|
||||
|
||||
CONFIG(release, debug|release): {
|
||||
@ -34,4 +36,3 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
bigint.cpp \
|
||||
mini-gmp.c
|
||||
include(ccache.pri);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
9
src/Makefile
Normal file
9
src/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
obj-m += minigmp.o
|
||||
minigmp-objs := mini-gmp.o export.o
|
||||
EXTRA_CFLAGS+=-DKERNEL=1
|
||||
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018-2021 QuasarApp.
|
||||
//# Copyright (C) 2018-2019 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
@ -31,7 +31,7 @@ BigInt::BigInt(const std::string &str, int base):
|
||||
mpz_set_str(data, str.c_str(), base);
|
||||
}
|
||||
|
||||
BigInt::BigInt(intMpz val):
|
||||
BigInt::BigInt(long val):
|
||||
BigInt() {
|
||||
mpz_set_si(data, val);
|
||||
}
|
||||
@ -58,7 +58,7 @@ BigInt BigInt::powm(BigInt val, const BigInt &pow, const BigInt &mod) {
|
||||
return val.powm(pow, mod);
|
||||
}
|
||||
|
||||
BigInt &BigInt::pow(uIntMpz pow) {
|
||||
BigInt &BigInt::pow(unsigned long pow) {
|
||||
mpz_pow_ui(data, data, pow);
|
||||
return *this;
|
||||
}
|
||||
@ -119,23 +119,23 @@ BigInt &BigInt::operator =(const std::string &imput) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
BigInt &BigInt::operator =(intMpz val) {
|
||||
BigInt &BigInt::operator =(long val) {
|
||||
mpz_set_si(data, val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// add operators
|
||||
|
||||
BigInt operator +(BigInt left, intMpz right) {
|
||||
BigInt operator +(BigInt left, long right) {
|
||||
if (right >= 0) {
|
||||
mpz_add_ui(left.data, left.data, static_cast<uIntMpz>(right));
|
||||
mpz_add_ui(left.data, left.data, static_cast<unsigned long>(right));
|
||||
return left;
|
||||
}
|
||||
|
||||
return left -= std::abs(right);
|
||||
}
|
||||
|
||||
BigInt operator +(intMpz left, BigInt right) {
|
||||
BigInt operator +(long left, BigInt right) {
|
||||
return right += left;
|
||||
}
|
||||
|
||||
@ -152,9 +152,9 @@ BigInt operator +(const std::string &left, const BigInt &right) {
|
||||
return BigInt(left) + right;
|
||||
}
|
||||
|
||||
BigInt& operator +=(BigInt &left, intMpz right) {
|
||||
BigInt& operator +=(BigInt &left, long right) {
|
||||
if (right >= 0) {
|
||||
mpz_add_ui(left.data, left.data, static_cast<uIntMpz>(right));
|
||||
mpz_add_ui(left.data, left.data, static_cast<unsigned long>(right));
|
||||
return left;
|
||||
}
|
||||
return left -= std::abs(right);
|
||||
@ -176,17 +176,17 @@ BigInt operator -(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator -(BigInt left, intMpz right) {
|
||||
BigInt operator -(BigInt left, long right) {
|
||||
if (right >= 0) {
|
||||
mpz_sub_ui(left.data, left.data, static_cast<uIntMpz>(right));
|
||||
mpz_sub_ui(left.data, left.data, static_cast<unsigned long>(right));
|
||||
return left;
|
||||
}
|
||||
return left += std::abs(right);
|
||||
}
|
||||
|
||||
BigInt operator -(intMpz left, BigInt right) {
|
||||
BigInt operator -(long left, BigInt right) {
|
||||
if (left >= 0) {
|
||||
mpz_ui_sub(right.data, static_cast<uIntMpz>(left), right.data);
|
||||
mpz_ui_sub(right.data, static_cast<unsigned long>(left), right.data);
|
||||
return right;
|
||||
}
|
||||
return right += std::abs(left);
|
||||
@ -214,9 +214,9 @@ BigInt& operator -=(BigInt &left, const std::string &right) {
|
||||
return left -= BigInt(right);
|
||||
}
|
||||
|
||||
BigInt& operator -=(BigInt &left, intMpz right) {
|
||||
BigInt& operator -=(BigInt &left, long right) {
|
||||
if (right >= 0) {
|
||||
mpz_sub_ui(left.data, left.data, static_cast<uIntMpz>(right));
|
||||
mpz_sub_ui(left.data, left.data, static_cast<unsigned long>(right));
|
||||
return left;
|
||||
}
|
||||
return left += std::abs(right);
|
||||
@ -229,8 +229,8 @@ BigInt operator /(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator /(BigInt left, intMpz right) {
|
||||
mpz_tdiv_q_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt operator /(BigInt left, long right) {
|
||||
mpz_tdiv_q_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
|
||||
if (right >= 0) {
|
||||
return left;
|
||||
@ -242,7 +242,7 @@ BigInt operator /(BigInt left, const std::string &right) {
|
||||
return left /= BigInt(right);
|
||||
}
|
||||
|
||||
BigInt operator /(intMpz left, BigInt right) {
|
||||
BigInt operator /(long left, BigInt right) {
|
||||
return BigInt(left) / right;
|
||||
}
|
||||
|
||||
@ -259,8 +259,8 @@ BigInt& operator /=(BigInt &left, const std::string &right) {
|
||||
return left /= BigInt(right);
|
||||
}
|
||||
|
||||
BigInt& operator /=(BigInt &left, intMpz right) {
|
||||
mpz_tdiv_q_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt& operator /=(BigInt &left, long right) {
|
||||
mpz_tdiv_q_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
|
||||
if (right >= 0) {
|
||||
return left;
|
||||
@ -274,8 +274,8 @@ BigInt operator *(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator *(BigInt left, intMpz right) {
|
||||
mpz_mul_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt operator *(BigInt left, long right) {
|
||||
mpz_mul_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
|
||||
if (right >= 0) {
|
||||
return left;
|
||||
@ -283,7 +283,7 @@ BigInt operator *(BigInt left, intMpz right) {
|
||||
return -left;
|
||||
}
|
||||
|
||||
BigInt operator *(intMpz left, BigInt right) {
|
||||
BigInt operator *(long left, BigInt right) {
|
||||
return right *= left;
|
||||
}
|
||||
|
||||
@ -304,8 +304,8 @@ BigInt& operator *=(BigInt &left, const std::string &right) {
|
||||
return left *= BigInt(right);
|
||||
}
|
||||
|
||||
BigInt& operator *=(BigInt &left, intMpz right) {
|
||||
mpz_mul_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt& operator *=(BigInt &left, long right) {
|
||||
mpz_mul_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
|
||||
if (right >= 0) {
|
||||
return left;
|
||||
@ -319,12 +319,12 @@ BigInt operator %(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator %(BigInt left, intMpz right) {
|
||||
mpz_tdiv_r_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt operator %(BigInt left, long right) {
|
||||
mpz_tdiv_r_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator %(intMpz left, BigInt right) {
|
||||
BigInt operator %(long left, BigInt right) {
|
||||
return BigInt(left) % right;
|
||||
}
|
||||
|
||||
@ -341,8 +341,8 @@ BigInt& operator %=(BigInt& left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt& operator %=(BigInt& left, intMpz right) {
|
||||
mpz_tdiv_r_ui(left.data, left.data, static_cast<uIntMpz>(std::abs(right)));
|
||||
BigInt& operator %=(BigInt& left, long right) {
|
||||
mpz_tdiv_r_ui(left.data, left.data, static_cast<unsigned long>(std::abs(right)));
|
||||
return left;
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ BigInt operator |(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator |(const BigInt &left, intMpz right) {
|
||||
BigInt operator |(const BigInt &left, long right) {
|
||||
return left | BigInt(right);
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ BigInt& operator |=(BigInt &left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt& operator |=(BigInt &left, intMpz right) {
|
||||
BigInt& operator |=(BigInt &left, long right) {
|
||||
return left |= BigInt(right);
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ BigInt operator &(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator &(const BigInt &left, intMpz right) {
|
||||
BigInt operator &(const BigInt &left, long right) {
|
||||
return left & BigInt(right);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ BigInt& operator &=(BigInt &left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt& operator &=(BigInt &left, intMpz right) {
|
||||
BigInt& operator &=(BigInt &left, long right) {
|
||||
return left &= BigInt(right);
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ BigInt operator ^(BigInt left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt operator ^(const BigInt &left, intMpz right) {
|
||||
BigInt operator ^(const BigInt &left, long right) {
|
||||
return left ^ BigInt(right);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ BigInt& operator ^=(BigInt &left, const BigInt &right) {
|
||||
return left;
|
||||
}
|
||||
|
||||
BigInt& operator ^=(BigInt &left, intMpz right) {
|
||||
BigInt& operator ^=(BigInt &left, long right) {
|
||||
return left ^= BigInt(right);
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ bool operator == (const BigInt& left, const BigInt& right) {
|
||||
return mpz_cmp(left.data, right.data) == 0;
|
||||
}
|
||||
|
||||
bool operator == (const BigInt& left, intMpz right) {
|
||||
bool operator == (const BigInt& left, long right) {
|
||||
return mpz_cmp_si(left.data, right) == 0;
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ bool operator == (const BigInt &left, const std::string &right) {
|
||||
return left == BigInt(right);
|
||||
}
|
||||
|
||||
bool operator == ( intMpz left, const BigInt & right) {
|
||||
bool operator == ( long left, const BigInt & right) {
|
||||
return right == left;
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ bool operator != (const BigInt &left, const BigInt& right) {
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
bool operator != (const BigInt &left, intMpz right) {
|
||||
bool operator != (const BigInt &left, long right) {
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ bool operator != (const BigInt &left, const std::string &right) {
|
||||
return left != BigInt(right);
|
||||
}
|
||||
|
||||
bool operator != ( intMpz left, const BigInt & right) {
|
||||
bool operator != ( long left, const BigInt & right) {
|
||||
return right != left;
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ bool operator < ( const BigInt &left, const BigInt& right) {
|
||||
return mpz_cmp(left.data, right.data) < 0;
|
||||
}
|
||||
|
||||
bool operator < ( const BigInt &left, intMpz right) {
|
||||
bool operator < ( const BigInt &left, long right) {
|
||||
return mpz_cmp_si(left.data, right) < 0;
|
||||
}
|
||||
|
||||
@ -543,7 +543,7 @@ bool operator < ( const BigInt &left, const std::string &right) {
|
||||
return left < BigInt(right);
|
||||
}
|
||||
|
||||
bool operator < ( intMpz left, const BigInt & right) {
|
||||
bool operator < ( long left, const BigInt & right) {
|
||||
return right > left;
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ bool operator > ( const BigInt &left, const BigInt& right) {
|
||||
return mpz_cmp(left.data, right.data) > 0;
|
||||
}
|
||||
|
||||
bool operator > ( const BigInt &left, intMpz right) {
|
||||
bool operator > ( const BigInt &left, long right) {
|
||||
return mpz_cmp_si(left.data, right) > 0;
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ bool operator > ( const BigInt &left, const std::string &right) {
|
||||
return left > BigInt(right);
|
||||
}
|
||||
|
||||
bool operator > ( intMpz left, const BigInt & right) {
|
||||
bool operator > ( long left, const BigInt & right) {
|
||||
return right < left;
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ bool operator <= ( const BigInt &left, const BigInt& right) {
|
||||
return mpz_cmp(left.data, right.data) <= 0;
|
||||
}
|
||||
|
||||
bool operator <= ( const BigInt &left, intMpz right) {
|
||||
bool operator <= ( const BigInt &left, long right) {
|
||||
return mpz_cmp_si(left.data, right) <= 0;
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ bool operator <= ( const BigInt &left, const std::string &right) {
|
||||
return left <= BigInt(right);
|
||||
}
|
||||
|
||||
bool operator <= ( intMpz left, const BigInt & right) {
|
||||
bool operator <= ( long left, const BigInt & right) {
|
||||
return right >= left;
|
||||
}
|
||||
|
||||
@ -595,7 +595,7 @@ bool operator >= ( const BigInt &left, const BigInt& right) {
|
||||
return mpz_cmp(left.data, right.data) >= 0;
|
||||
}
|
||||
|
||||
bool operator >= ( const BigInt &left, intMpz right) {
|
||||
bool operator >= ( const BigInt &left, long right) {
|
||||
return mpz_cmp_si(left.data, right) >= 0;
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ bool operator >= ( const BigInt &left, const std::string &right) {
|
||||
return left >= BigInt(right);
|
||||
}
|
||||
|
||||
bool operator >= ( intMpz left, const BigInt & right) {
|
||||
bool operator >= ( long left, const BigInt & right) {
|
||||
return right <= left;
|
||||
}
|
||||
|
||||
|
198
src/bigint.h
198
src/bigint.h
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018-2021 QuasarApp.
|
||||
//# Copyright (C) 2018-2019 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
@ -24,7 +24,7 @@ public:
|
||||
BigInt();
|
||||
BigInt(const BigInt& val, int bitCount = -1);
|
||||
BigInt(const std::string &imput, int base = 10);
|
||||
BigInt(intMpz val);
|
||||
BigInt(long val);
|
||||
BigInt(char item, unsigned int size, int base);
|
||||
|
||||
std::string getString(int base = 10) const;
|
||||
@ -33,7 +33,7 @@ public:
|
||||
BigInt& powm(const BigInt &pow, const BigInt &mod);
|
||||
static BigInt powm(BigInt val, const BigInt & pow, const BigInt &mod);
|
||||
|
||||
BigInt& pow(uIntMpz pow);
|
||||
BigInt& pow(unsigned long pow);
|
||||
BigInt& log(int base);
|
||||
/**
|
||||
* @brief sizeBits
|
||||
@ -44,7 +44,7 @@ public:
|
||||
|
||||
/**
|
||||
* @brief longBits
|
||||
* @return current length in Bits of number
|
||||
* @return current long in Bits of number
|
||||
*/
|
||||
int longBits() const;
|
||||
int longBytes() const;
|
||||
@ -65,114 +65,114 @@ public:
|
||||
|
||||
BigInt& operator = (const BigInt& val);
|
||||
BigInt& operator = (const std::string &imput);
|
||||
BigInt& operator = (intMpz val);
|
||||
BigInt& operator = (long val);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator + ( BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator + ( BigInt left, const std::string &right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator + ( BigInt left, intMpz right);
|
||||
friend BigInt operator + ( BigInt left, const BigInt& right);
|
||||
friend BigInt operator + ( BigInt left, const std::string &right);
|
||||
friend BigInt operator + ( BigInt left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator + ( intMpz left, BigInt right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator + ( const std::string &left, const BigInt &right);
|
||||
friend BigInt operator + ( long left, BigInt right);
|
||||
friend BigInt operator + ( const std::string &left, const BigInt &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator += ( BigInt &left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator += ( BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator += ( BigInt &left, const std::string &right);
|
||||
friend BigInt& operator += ( BigInt &left, long right);
|
||||
friend BigInt& operator += ( BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator += ( BigInt &left, const std::string &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator - ( BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator - ( BigInt left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator - ( BigInt left, const std::string &right);
|
||||
friend BigInt operator - ( BigInt left, const BigInt& right);
|
||||
friend BigInt operator - ( BigInt left, long right);
|
||||
friend BigInt operator - ( BigInt left, const std::string &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator - ( intMpz right, BigInt left);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator - ( const std::string &right, const BigInt &left);
|
||||
friend BigInt operator - ( long right, BigInt left);
|
||||
friend BigInt operator - ( const std::string &right, const BigInt &left);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator-(BigInt val);
|
||||
friend BigInt operator-(BigInt val);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator -= ( BigInt &left, intMpz right);
|
||||
friend BigInt& operator -= ( BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator -= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator -= ( BigInt &left, const std::string &right);
|
||||
friend BigInt& operator -= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator -= ( BigInt &left, const std::string &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator / ( BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator / ( BigInt left, const std::string &right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator / ( BigInt left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator / ( intMpz left, BigInt right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator / ( const std::string &left, const BigInt &right);
|
||||
friend BigInt operator / ( BigInt left, const BigInt& right);
|
||||
friend BigInt operator / ( BigInt left, const std::string &right);
|
||||
friend BigInt operator / ( BigInt left, long right);
|
||||
friend BigInt operator / ( long left, BigInt right);
|
||||
friend BigInt operator / ( const std::string &left, const BigInt &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator /= ( BigInt &left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator /= ( BigInt &left, const std::string &right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator /= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator /= ( BigInt &left, long right);
|
||||
friend BigInt& operator /= ( BigInt &left, const std::string &right);
|
||||
friend BigInt& operator /= ( BigInt &left, const BigInt& right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator * ( BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator * ( BigInt left, const std::string &right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator * ( BigInt left, intMpz right);
|
||||
friend BigInt operator * ( BigInt left, const BigInt& right);
|
||||
friend BigInt operator * ( BigInt left, const std::string &right);
|
||||
friend BigInt operator * ( BigInt left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator * ( intMpz left, BigInt right);
|
||||
friend BigInt operator * ( long left, BigInt right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator *= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator *= ( BigInt &left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator *= ( BigInt &left, const std::string &right);
|
||||
friend BigInt& operator *= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator *= ( BigInt &left, long right);
|
||||
friend BigInt& operator *= ( BigInt &left, const std::string &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator % ( BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator % ( BigInt left, const std::string &right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator % ( BigInt left, intMpz right);
|
||||
friend BigInt operator % ( BigInt left, const BigInt& right);
|
||||
friend BigInt operator % ( BigInt left, const std::string &right);
|
||||
friend BigInt operator % ( BigInt left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator % ( intMpz left, BigInt right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator % ( const std::string & left, const BigInt &right);
|
||||
friend BigInt operator % ( long left, BigInt right);
|
||||
friend BigInt operator % ( const std::string & left, const BigInt &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator %= ( BigInt &left, intMpz right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator %= ( BigInt &left, const std::string &right);
|
||||
friend BigInt& operator %= ( BigInt &left, long right);
|
||||
friend BigInt& operator %= ( BigInt &left, const std::string &right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator %= ( BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator %= ( BigInt &left, const BigInt& right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator << ( BigInt left, int right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator >> ( BigInt left, int right);
|
||||
friend BigInt operator << ( BigInt left, int right);
|
||||
friend BigInt operator >> ( BigInt left, int right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator <<= ( BigInt &left, int right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator >>= ( BigInt &left, int right);
|
||||
friend BigInt& operator <<= ( BigInt &left, int right);
|
||||
friend BigInt& operator >>= ( BigInt &left, int right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator == ( intMpz left, const std::string& right);
|
||||
friend bool operator == ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator == ( const BigInt& left, long right);
|
||||
friend bool operator == ( const BigInt& left, const std::string& right);
|
||||
friend bool operator == ( const std::string& left, const BigInt& right);
|
||||
friend bool operator == ( const BigInt& left, const std::string& right);
|
||||
friend bool operator == ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( const BigInt& left, const std::string& str);
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator != ( intMpz left, const std::string& right);
|
||||
friend bool operator != ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator != ( const BigInt& left, long right);
|
||||
friend bool operator != ( const BigInt& left, const std::string& str);
|
||||
friend bool operator != ( const std::string& left, const BigInt& right);
|
||||
friend bool operator != ( const BigInt& left, const std::string& right);
|
||||
friend bool operator != ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( const BigInt& left, const std::string& str);
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator < ( intMpz left, const std::string& right);
|
||||
friend bool operator < ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator < ( const BigInt& left, long right);
|
||||
friend bool operator < ( const BigInt& left, const std::string& str);
|
||||
friend bool operator < ( const std::string& left, const BigInt& right);
|
||||
friend bool operator < ( const BigInt& left, const std::string& right);
|
||||
friend bool operator < ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( const BigInt& left, const std::string& str);
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator > ( intMpz left, const std::string& right);
|
||||
friend bool operator > ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator > ( const BigInt& left, long right);
|
||||
friend bool operator > ( const BigInt& left, const std::string& str);
|
||||
friend bool operator > ( const std::string& left, const BigInt& right);
|
||||
friend bool operator > ( const BigInt& left, const std::string& right);
|
||||
friend bool operator > ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( const BigInt& left, const std::string& str);
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator <= ( intMpz left, const std::string& right);
|
||||
friend bool operator <= ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator <= ( const BigInt& left, long right);
|
||||
friend bool operator <= ( const BigInt& left, const std::string& str);
|
||||
friend bool operator <= ( const std::string& left, const BigInt& right);
|
||||
friend bool operator <= ( const BigInt& left, const std::string& right);
|
||||
friend bool operator <= ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( const BigInt& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( const BigInt& left, intMpz right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( const BigInt& left, const std::string& str);
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( const std::string& left, const BigInt& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( const BigInt& left, const std::string& right);
|
||||
friend bool MINIGMPSHARED_EXPORT operator >= ( intMpz left, const std::string& right);
|
||||
friend bool operator >= ( const BigInt& left, const BigInt& right);
|
||||
friend bool operator >= ( const BigInt& left, long right);
|
||||
friend bool operator >= ( const BigInt& left, const std::string& str);
|
||||
friend bool operator >= ( const std::string& left, const BigInt& right);
|
||||
friend bool operator >= ( const BigInt& left, const std::string& right);
|
||||
friend bool operator >= ( long left, const std::string& right);
|
||||
|
||||
friend bool MINIGMPSHARED_EXPORT operator!(const BigInt& val);
|
||||
friend bool operator!(const BigInt& val);
|
||||
|
||||
BigInt& operator-- ();
|
||||
BigInt& operator++ ();
|
||||
@ -181,25 +181,25 @@ public:
|
||||
BigInt operator++ (int);
|
||||
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator~ (BigInt val);
|
||||
friend BigInt operator~ (BigInt val);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator| (BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator| (const BigInt &left, intMpz right);
|
||||
friend BigInt operator| (BigInt left, const BigInt& right);
|
||||
friend BigInt operator| (const BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator|= (BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator|= (BigInt &left, intMpz right);
|
||||
friend BigInt& operator|= (BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator|= (BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator& (BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator& (const BigInt &left, intMpz right);
|
||||
friend BigInt operator& (BigInt left, const BigInt& right);
|
||||
friend BigInt operator& (const BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator&= (BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator&= (BigInt &left, intMpz right);
|
||||
friend BigInt& operator&= (BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator&= (BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator^ (BigInt left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT operator^ (const BigInt &left, intMpz right);
|
||||
friend BigInt operator^ (BigInt left, const BigInt& right);
|
||||
friend BigInt operator^ (const BigInt &left, long right);
|
||||
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator^= (BigInt &left, const BigInt& right);
|
||||
friend BigInt MINIGMPSHARED_EXPORT & operator^= (BigInt &left, intMpz right);
|
||||
friend BigInt& operator^= (BigInt &left, const BigInt& right);
|
||||
friend BigInt& operator^= (BigInt &left, long right);
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
!isEmpty(CCACHE_INCLUDE):error("ccache.pri already included")
|
||||
CCACHE_INCLUDE = 1
|
||||
|
||||
contains(QMAKE_HOST.os, Linux):{
|
||||
BIN = $$system(which ccache)
|
||||
|
||||
!isEmpty(BIN) {
|
||||
message(ccache detected in $$BIN)
|
||||
QMAKE_CXX='$$BIN $$QMAKE_CXX'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
134
src/mini-gmp.c
134
src/mini-gmp.c
@ -60,8 +60,8 @@ see https://www.gnu.org/licenses/. */
|
||||
#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
|
||||
#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1)
|
||||
|
||||
#define GMP_ULONG_BITS (sizeof(uIntMpz) * CHAR_BIT)
|
||||
#define GMP_ULONG_HIGHBIT ((uIntMpz) 1 << (GMP_ULONG_BITS - 1))
|
||||
#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
|
||||
#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
|
||||
|
||||
#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
|
||||
@ -1477,19 +1477,19 @@ mpz_realloc (mpz_t r, mp_size_t size)
|
||||
|
||||
/* MPZ assignment and basic conversions. */
|
||||
void
|
||||
mpz_set_si (mpz_t r, intMpz x)
|
||||
mpz_set_si (mpz_t r, signed long int x)
|
||||
{
|
||||
if (x >= 0)
|
||||
mpz_set_ui (r, x);
|
||||
else /* (x < 0) */
|
||||
{
|
||||
r->_mp_size = -1;
|
||||
MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (uIntMpz, x);
|
||||
MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mpz_set_ui (mpz_t r, uIntMpz x)
|
||||
mpz_set_ui (mpz_t r, unsigned long int x)
|
||||
{
|
||||
if (x > 0)
|
||||
{
|
||||
@ -1518,14 +1518,14 @@ mpz_set (mpz_t r, const mpz_t x)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_init_set_si (mpz_t r, intMpz x)
|
||||
mpz_init_set_si (mpz_t r, signed long int x)
|
||||
{
|
||||
mpz_init (r);
|
||||
mpz_set_si (r, x);
|
||||
}
|
||||
|
||||
void
|
||||
mpz_init_set_ui (mpz_t r, uIntMpz x)
|
||||
mpz_init_set_ui (mpz_t r, unsigned long int x)
|
||||
{
|
||||
mpz_init (r);
|
||||
mpz_set_ui (r, x);
|
||||
@ -1559,7 +1559,7 @@ mpz_fits_ulong_p (const mpz_t u)
|
||||
return (us == (us > 0));
|
||||
}
|
||||
|
||||
intMpz
|
||||
long int
|
||||
mpz_get_si (const mpz_t u)
|
||||
{
|
||||
if (u->_mp_size < 0)
|
||||
@ -1569,7 +1569,7 @@ mpz_get_si (const mpz_t u)
|
||||
return (long) (mpz_get_ui (u) & ~GMP_LIMB_HIGHBIT);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
unsigned long int
|
||||
mpz_get_ui (const mpz_t u)
|
||||
{
|
||||
return u->_mp_size == 0 ? 0 : u->_mp_d[0];
|
||||
@ -1783,7 +1783,7 @@ mpz_sgn (const mpz_t u)
|
||||
}
|
||||
|
||||
int
|
||||
mpz_cmp_si (const mpz_t u, intMpz v)
|
||||
mpz_cmp_si (const mpz_t u, long v)
|
||||
{
|
||||
mp_size_t usize = u->_mp_size;
|
||||
|
||||
@ -1798,7 +1798,7 @@ mpz_cmp_si (const mpz_t u, intMpz v)
|
||||
}
|
||||
|
||||
int
|
||||
mpz_cmp_ui (const mpz_t u, uIntMpz v)
|
||||
mpz_cmp_ui (const mpz_t u, unsigned long v)
|
||||
{
|
||||
mp_size_t usize = u->_mp_size;
|
||||
|
||||
@ -1825,7 +1825,7 @@ mpz_cmp (const mpz_t a, const mpz_t b)
|
||||
}
|
||||
|
||||
int
|
||||
mpz_cmpabs_ui (const mpz_t u, uIntMpz v)
|
||||
mpz_cmpabs_ui (const mpz_t u, unsigned long v)
|
||||
{
|
||||
if (GMP_ABS (u->_mp_size) > 1)
|
||||
return 1;
|
||||
@ -1867,7 +1867,7 @@ mpz_swap (mpz_t u, mpz_t v)
|
||||
|
||||
/* Adds to the absolute value. Returns new size, but doesn't store it. */
|
||||
static mp_size_t
|
||||
mpz_abs_add_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
|
||||
{
|
||||
mp_size_t an;
|
||||
mp_ptr rp;
|
||||
@ -1892,7 +1892,7 @@ mpz_abs_add_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
|
||||
but doesn't store it. */
|
||||
static mp_size_t
|
||||
mpz_abs_sub_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
|
||||
{
|
||||
mp_size_t an = GMP_ABS (a->_mp_size);
|
||||
mp_ptr rp;
|
||||
@ -1916,7 +1916,7 @@ mpz_abs_sub_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_add_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
|
||||
{
|
||||
if (a->_mp_size >= 0)
|
||||
r->_mp_size = mpz_abs_add_ui (r, a, b);
|
||||
@ -1925,7 +1925,7 @@ mpz_add_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_sub_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
|
||||
{
|
||||
if (a->_mp_size < 0)
|
||||
r->_mp_size = -mpz_abs_add_ui (r, a, b);
|
||||
@ -1934,7 +1934,7 @@ mpz_sub_ui (mpz_t r, const mpz_t a, uIntMpz b)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_ui_sub (mpz_t r, uIntMpz a, const mpz_t b)
|
||||
mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
|
||||
{
|
||||
if (b->_mp_size < 0)
|
||||
r->_mp_size = mpz_abs_add_ui (r, b, a);
|
||||
@ -2018,19 +2018,19 @@ mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
|
||||
|
||||
/* MPZ multiplication */
|
||||
void
|
||||
mpz_mul_si (mpz_t r, const mpz_t u, intMpz v)
|
||||
mpz_mul_si (mpz_t r, const mpz_t u, long int v)
|
||||
{
|
||||
if (v < 0)
|
||||
{
|
||||
mpz_mul_ui (r, u, GMP_NEG_CAST (uIntMpz, v));
|
||||
mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v));
|
||||
mpz_neg (r, r);
|
||||
}
|
||||
else
|
||||
mpz_mul_ui (r, u, (uIntMpz) v);
|
||||
mpz_mul_ui (r, u, (unsigned long int) v);
|
||||
}
|
||||
|
||||
void
|
||||
mpz_mul_ui (mpz_t r, const mpz_t u, uIntMpz v)
|
||||
mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
|
||||
{
|
||||
mp_size_t un, us;
|
||||
mp_ptr tp;
|
||||
@ -2127,7 +2127,7 @@ mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_addmul_ui (mpz_t r, const mpz_t u, uIntMpz v)
|
||||
mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
|
||||
{
|
||||
mpz_t t;
|
||||
mpz_init (t);
|
||||
@ -2137,7 +2137,7 @@ mpz_addmul_ui (mpz_t r, const mpz_t u, uIntMpz v)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_submul_ui (mpz_t r, const mpz_t u, uIntMpz v)
|
||||
mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
|
||||
{
|
||||
mpz_t t;
|
||||
mpz_init (t);
|
||||
@ -2533,9 +2533,9 @@ mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
|
||||
return res;
|
||||
}
|
||||
|
||||
static uIntMpz
|
||||
static unsigned long
|
||||
mpz_div_qr_ui (mpz_t q, mpz_t r,
|
||||
const mpz_t n, uIntMpz d, enum mpz_div_round_mode mode)
|
||||
const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
|
||||
{
|
||||
mp_size_t ns, qn;
|
||||
mp_ptr qp;
|
||||
@ -2589,90 +2589,90 @@ mpz_div_qr_ui (mpz_t q, mpz_t r,
|
||||
return rl;
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_cdiv_q_ui (mpz_t q, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_fdiv_q_ui (mpz_t q, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_tdiv_q_ui (mpz_t q, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_cdiv_r_ui (mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL);
|
||||
}
|
||||
uIntMpz
|
||||
mpz_fdiv_r_ui (mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
|
||||
}
|
||||
uIntMpz
|
||||
mpz_tdiv_r_ui (mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_cdiv_ui (const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_cdiv_ui (const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_fdiv_ui (const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_fdiv_ui (const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_tdiv_ui (const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_tdiv_ui (const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC);
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_mod_ui (mpz_t r, const mpz_t n, uIntMpz d)
|
||||
unsigned long
|
||||
mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
|
||||
}
|
||||
|
||||
void
|
||||
mpz_divexact_ui (mpz_t q, const mpz_t n, uIntMpz d)
|
||||
mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
|
||||
{
|
||||
gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC));
|
||||
}
|
||||
|
||||
int
|
||||
mpz_divisible_ui_p (const mpz_t n, uIntMpz d)
|
||||
mpz_divisible_ui_p (const mpz_t n, unsigned long d)
|
||||
{
|
||||
return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
|
||||
}
|
||||
@ -2722,8 +2722,8 @@ mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
|
||||
return u << shift;
|
||||
}
|
||||
|
||||
uIntMpz
|
||||
mpz_gcd_ui (mpz_t g, const mpz_t u, uIntMpz v)
|
||||
unsigned long
|
||||
mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
|
||||
{
|
||||
mp_size_t un;
|
||||
|
||||
@ -2831,7 +2831,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
|
||||
if (u->_mp_size == 0)
|
||||
{
|
||||
/* g = 0 u + sgn(v) v */
|
||||
intMpz sign = mpz_sgn (v);
|
||||
signed long sign = mpz_sgn (v);
|
||||
mpz_abs (g, v);
|
||||
if (s)
|
||||
mpz_set_ui (s, 0);
|
||||
@ -2843,7 +2843,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
|
||||
if (v->_mp_size == 0)
|
||||
{
|
||||
/* g = sgn(u) u + 0 v */
|
||||
intMpz sign = mpz_sgn (u);
|
||||
signed long sign = mpz_sgn (u);
|
||||
mpz_abs (g, u);
|
||||
if (s)
|
||||
mpz_set_si (s, sign);
|
||||
@ -3025,7 +3025,7 @@ mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_lcm_ui (mpz_t r, const mpz_t u, uIntMpz v)
|
||||
mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
|
||||
{
|
||||
if (v == 0 || u->_mp_size == 0)
|
||||
{
|
||||
@ -3075,9 +3075,9 @@ mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
|
||||
/* Higher level operations (sqrt, pow and root) */
|
||||
|
||||
void
|
||||
mpz_pow_ui (mpz_t r, const mpz_t b, uIntMpz e)
|
||||
mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
|
||||
{
|
||||
uIntMpz bit;
|
||||
unsigned long bit;
|
||||
mpz_t tr;
|
||||
mpz_init_set_ui (tr, 1);
|
||||
|
||||
@ -3096,7 +3096,7 @@ mpz_pow_ui (mpz_t r, const mpz_t b, uIntMpz e)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_ui_pow_ui (mpz_t r, uIntMpz blimb, uIntMpz e)
|
||||
mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
|
||||
{
|
||||
mpz_t b;
|
||||
mpz_pow_ui (r, mpz_roinit_n (b, &blimb, 1), e);
|
||||
@ -3208,7 +3208,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_powm_ui (mpz_t r, const mpz_t b, uIntMpz elimb, const mpz_t m)
|
||||
mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
|
||||
{
|
||||
mpz_t e;
|
||||
mpz_powm (r, b, mpz_roinit_n (e, &elimb, 1), m);
|
||||
@ -3216,7 +3216,7 @@ mpz_powm_ui (mpz_t r, const mpz_t b, uIntMpz elimb, const mpz_t m)
|
||||
|
||||
/* x=trunc(y^(1/z)), r=y-x^z */
|
||||
void
|
||||
mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, uIntMpz z)
|
||||
mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
|
||||
{
|
||||
int sgn;
|
||||
mpz_t t, u;
|
||||
@ -3276,7 +3276,7 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, uIntMpz z)
|
||||
}
|
||||
|
||||
int
|
||||
mpz_root (mpz_t x, const mpz_t y, uIntMpz z)
|
||||
mpz_root (mpz_t x, const mpz_t y, unsigned long z)
|
||||
{
|
||||
int res;
|
||||
mpz_t r;
|
||||
@ -3347,7 +3347,7 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
|
||||
/* Combinatorics */
|
||||
|
||||
void
|
||||
mpz_fac_ui (mpz_t x, uIntMpz n)
|
||||
mpz_fac_ui (mpz_t x, unsigned long n)
|
||||
{
|
||||
mpz_set_ui (x, n + (n == 0));
|
||||
while (n > 2)
|
||||
@ -3355,7 +3355,7 @@ mpz_fac_ui (mpz_t x, uIntMpz n)
|
||||
}
|
||||
|
||||
void
|
||||
mpz_bin_uiui (mpz_t r, uIntMpz n, uIntMpz k)
|
||||
mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
|
||||
{
|
||||
mpz_t t;
|
||||
|
||||
@ -3453,7 +3453,7 @@ mpz_probab_prime_p (const mpz_t n, int reps)
|
||||
|
||||
for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
|
||||
{
|
||||
mpz_set_ui (y, (uIntMpz) j*j+j+41);
|
||||
mpz_set_ui (y, (unsigned long) j*j+j+41);
|
||||
if (mpz_cmp (y, nm1) >= 0)
|
||||
{
|
||||
/* Don't try any further bases. This "early" break does not affect
|
||||
|
103
src/mini-gmp.h
103
src/mini-gmp.h
@ -48,19 +48,16 @@ extern "C" {
|
||||
#define UN_USED(X) (void)X
|
||||
|
||||
void mp_set_memory_functions (void *(*) (size_t),
|
||||
void *(*) (void *, size_t, size_t),
|
||||
void (*) (void *, size_t));
|
||||
void *(*) (void *, size_t, size_t),
|
||||
void (*) (void *, size_t));
|
||||
|
||||
void mp_get_memory_functions (void *(**) (size_t),
|
||||
void *(**) (void *, size_t, size_t),
|
||||
void (**) (void *, size_t));
|
||||
void *(**) (void *, size_t, size_t),
|
||||
void (**) (void *, size_t));
|
||||
|
||||
typedef unsigned long long uIntMpz;
|
||||
typedef long long intMpz;
|
||||
|
||||
typedef uIntMpz mp_limb_t;
|
||||
typedef intMpz mp_size_t;
|
||||
typedef uIntMpz mp_bitcnt_t;
|
||||
typedef unsigned long mp_limb_t;
|
||||
typedef long mp_size_t;
|
||||
typedef unsigned long mp_bitcnt_t;
|
||||
|
||||
typedef mp_limb_t *mp_ptr;
|
||||
typedef const mp_limb_t *mp_srcptr;
|
||||
@ -68,10 +65,10 @@ typedef const mp_limb_t *mp_srcptr;
|
||||
typedef struct
|
||||
{
|
||||
int _mp_alloc; /* Number of *limbs* allocated and pointed
|
||||
to by the _mp_d field. */
|
||||
to by the _mp_d field. */
|
||||
int _mp_size; /* abs(_mp_size) is the number of limbs the
|
||||
last field points to. If _mp_size is
|
||||
negative this is a negative number. */
|
||||
last field points to. If _mp_size is
|
||||
negative this is a negative number. */
|
||||
mp_limb_t *_mp_d; /* Pointer to the limbs. */
|
||||
} __mpz_struct;
|
||||
|
||||
@ -132,10 +129,10 @@ void mpz_clear (mpz_t);
|
||||
#define mpz_even_p(z) (! mpz_odd_p (z))
|
||||
|
||||
int mpz_sgn (const mpz_t);
|
||||
int mpz_cmp_si (const mpz_t, intMpz);
|
||||
int mpz_cmp_ui (const mpz_t, uIntMpz);
|
||||
int mpz_cmp_si (const mpz_t, long);
|
||||
int mpz_cmp_ui (const mpz_t, unsigned long);
|
||||
int mpz_cmp (const mpz_t, const mpz_t);
|
||||
int mpz_cmpabs_ui (const mpz_t, uIntMpz);
|
||||
int mpz_cmpabs_ui (const mpz_t, unsigned long);
|
||||
int mpz_cmpabs (const mpz_t, const mpz_t);
|
||||
int mpz_cmp_d (const mpz_t, double);
|
||||
int mpz_cmpabs_d (const mpz_t, double);
|
||||
@ -144,19 +141,19 @@ void mpz_abs (mpz_t, const mpz_t);
|
||||
void mpz_neg (mpz_t, const mpz_t);
|
||||
void mpz_swap (mpz_t, mpz_t);
|
||||
|
||||
void mpz_add_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_add (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_sub_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_ui_sub (mpz_t, uIntMpz, const mpz_t);
|
||||
void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
|
||||
void mpz_sub (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_mul_si (mpz_t, const mpz_t, intMpz);
|
||||
void mpz_mul_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_mul_si (mpz_t, const mpz_t, long int);
|
||||
void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
|
||||
void mpz_mul (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_addmul_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
|
||||
void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_submul_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
|
||||
void mpz_submul (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
@ -183,29 +180,29 @@ void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
|
||||
int mpz_divisible_p (const mpz_t, const mpz_t);
|
||||
int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
uIntMpz mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_cdiv_q_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_fdiv_q_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_tdiv_q_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_cdiv_r_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_fdiv_r_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_tdiv_r_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_cdiv_ui (const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_fdiv_ui (const mpz_t, uIntMpz);
|
||||
uIntMpz mpz_tdiv_ui (const mpz_t, uIntMpz);
|
||||
unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
|
||||
|
||||
uIntMpz mpz_mod_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
void mpz_divexact_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
int mpz_divisible_ui_p (const mpz_t, uIntMpz);
|
||||
int mpz_divisible_ui_p (const mpz_t, unsigned long);
|
||||
|
||||
uIntMpz mpz_gcd_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_lcm_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
|
||||
int mpz_invert (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
@ -213,16 +210,16 @@ void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
|
||||
void mpz_sqrt (mpz_t, const mpz_t);
|
||||
int mpz_perfect_square_p (const mpz_t);
|
||||
|
||||
void mpz_pow_ui (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_ui_pow_ui (mpz_t, uIntMpz, uIntMpz);
|
||||
void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
|
||||
void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_powm_ui (mpz_t, const mpz_t, uIntMpz, const mpz_t);
|
||||
void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
|
||||
|
||||
void mpz_rootrem (mpz_t, mpz_t, const mpz_t, uIntMpz);
|
||||
int mpz_root (mpz_t, const mpz_t, uIntMpz);
|
||||
void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
int mpz_root (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
void mpz_fac_ui (mpz_t, uIntMpz);
|
||||
void mpz_bin_uiui (mpz_t, uIntMpz, uIntMpz);
|
||||
void mpz_fac_ui (mpz_t, unsigned long);
|
||||
void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
|
||||
|
||||
int mpz_probab_prime_p (const mpz_t, int);
|
||||
|
||||
@ -243,8 +240,8 @@ mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
|
||||
|
||||
int mpz_fits_slong_p (const mpz_t);
|
||||
int mpz_fits_ulong_p (const mpz_t);
|
||||
intMpz mpz_get_si (const mpz_t);
|
||||
uIntMpz mpz_get_ui (const mpz_t);
|
||||
long int mpz_get_si (const mpz_t);
|
||||
unsigned long int mpz_get_ui (const mpz_t);
|
||||
double mpz_get_d (const mpz_t);
|
||||
size_t mpz_size (const mpz_t);
|
||||
mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
|
||||
@ -258,13 +255,13 @@ mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t);
|
||||
|
||||
#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
|
||||
|
||||
void mpz_set_si (mpz_t, intMpz);
|
||||
void mpz_set_ui (mpz_t, uIntMpz);
|
||||
void mpz_set_si (mpz_t, signed long int);
|
||||
void mpz_set_ui (mpz_t, unsigned long int);
|
||||
void mpz_set (mpz_t, const mpz_t);
|
||||
void mpz_set_d (mpz_t, double);
|
||||
|
||||
void mpz_init_set_si (mpz_t, intMpz);
|
||||
void mpz_init_set_ui (mpz_t, uIntMpz);
|
||||
void mpz_init_set_si (mpz_t, signed long int);
|
||||
void mpz_init_set_ui (mpz_t, unsigned long int);
|
||||
void mpz_init_set (mpz_t, const mpz_t);
|
||||
void mpz_init_set_d (mpz_t, double);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//#
|
||||
//# Copyright (C) 2018-2021 QuasarApp.
|
||||
//# Copyright (C) 2018-2019 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
@ -10,10 +10,10 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
# define MINIGMPSHARED_EXPORT __declspec(dllexport)
|
||||
#elif (linux) || defined (__linux__) || defined (__APPLE__)
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
# define MINIGMPSHARED_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
# define MINIGMPSHARED_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2018-2021 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
set(CURRENT_PROJECT ${PROJECT_NAME}Test)
|
||||
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Test REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test REQUIRED)
|
||||
|
||||
file(GLOB SOURCE_CPP
|
||||
"*.cpp"
|
||||
)
|
||||
|
||||
add_executable(${CURRENT_PROJECT} ${SOURCE_CPP})
|
||||
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test QtBigint)
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
initTests()
|
||||
addTests("QtBigint" ${CURRENT_PROJECT})
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 QuasarApp.
|
||||
# Copyright (C) 2018-2019 QuasarApp.
|
||||
# Distributed under the lgplv3 software license, see the accompanying
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <QtTest>
|
||||
#include <bigint.h>
|
||||
#include <limits>
|
||||
#include <random>
|
||||
|
||||
// add necessary includes here
|
||||
|
||||
@ -740,22 +739,22 @@ void arithmetictests::testOperators() {
|
||||
QVERIFY(num1.sizeBytes() == 0);
|
||||
num1 = 1;
|
||||
|
||||
QVERIFY(num1.sizeBytes() == sizeof (intMpz));
|
||||
QVERIFY(num1.sizeBytes() == sizeof (long));
|
||||
|
||||
num1++;
|
||||
QVERIFY(num1.sizeBytes() == sizeof (intMpz));
|
||||
QVERIFY(num1.sizeBytes() == sizeof (long));
|
||||
|
||||
num1+= 0xFF;
|
||||
QVERIFY(num1.sizeBytes() == sizeof (intMpz));
|
||||
QVERIFY(num1.sizeBytes() == sizeof (long));
|
||||
|
||||
num1 += std::numeric_limits<intMpz>::max();
|
||||
num1 += std::numeric_limits<intMpz>::max();
|
||||
num1 += std::numeric_limits<long>::max();
|
||||
num1 += std::numeric_limits<long>::max();
|
||||
|
||||
QVERIFY(num1.sizeBytes() == sizeof (intMpz) * 2);
|
||||
QVERIFY(num1.sizeBytes() == sizeof (long) * 2);
|
||||
|
||||
num1 = 1;
|
||||
QVERIFY(num1.sizeBytes() == sizeof (intMpz));
|
||||
QVERIFY(num1.sizeType() == sizeof (intMpz) * 2);
|
||||
QVERIFY(num1.sizeBytes() == sizeof (long));
|
||||
QVERIFY(num1.sizeType() == sizeof (long) * 2);
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user