From cea62c94041af7cb9821200c030ea0322a1c8af8 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 29 Jan 2019 01:37:36 -0500 Subject: [PATCH] Updated so it is unnecessary to link gmp every time it is included --- Algorithms.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Algorithms.hpp b/Algorithms.hpp index 8ba2eed..df15030 100644 --- a/Algorithms.hpp +++ b/Algorithms.hpp @@ -29,8 +29,11 @@ #include //This library is licensed under lgplv3 //You can find more information at gmplib.org -//IN ORDER TO USE THIS LIBRARY AS IS YOU MUST LINK BOTH libgmpxx AND libgmp TO COMPILE +//In order to use this functionality you must use the -DNEEDGMP flag in your compiler +//You must also link both libgmpxx and libgmp +#ifdef NEEDGMP #include //This is necessary for the getGmpFib function for numbers larger than a normal int can hold. It can be commented out if needed +#endif //NEEDGMP namespace mee{ @@ -61,7 +64,11 @@ bool isFound(T num, std::vector list); std::vector getPermutations(std::string master, int num = 0); //These functions return the numth Fibonacci number uint64_t getFib(uint64_t num); +//In order to use this functionality you must use the -DNEEDGMP flag in your compiler +//You must also link both libgmpxx and libgmp +#ifdef NEEDGMP mpz_class getMpzFib(uint64_t num); +#endif //NEEDGMP //This is a function that performs a bubble sort on a vector template bool bubbleSort(std::vector nums); @@ -271,6 +278,9 @@ uint64_t getFib(uint64_t num){ return fib; } +//In order to use this functionality you must use the -DNEEDGMP flag in your compiler +//You must also link both libgmpxx and libgmp +#ifdef NEEDGMP mpz_class getMpzFib(uint64_t num){ //Make sure the number is within bounds if(num <= 0){ @@ -292,6 +302,7 @@ mpz_class getMpzFib(uint64_t num){ return tempNums[(num - 1) % 3]; //Return the answer } +#endif //NEEDGMP //This is a function that performs a bubble sort on a vector template