This commit is contained in:
Ashish Bhanu Daulatabad 2021-04-13 13:11:29 +05:30
parent 27e9282369
commit 265a865ed8
3 changed files with 10 additions and 5 deletions

View File

@ -22,9 +22,9 @@
* @author [Ashish Daulatabad](https://github.com/AshishYUO)
*/
#include <cassert> /// for assert
#include <iostream> /// for IO operation
#include <iostream> /// for IO operations
#include "uint256_t.hpp" /// for 256-bit integer;
#include "uint256_t.hpp" /// for 256-bit integer
/**
* @namespace ciphers

View File

@ -32,7 +32,7 @@ struct std::is_unsigned<uint128_t> : std::true_type {};
* @details Adds two long integer, only used for printing numbers
* @param first First integer string
* @param second Second integer string
* @returns string denoting the addition of both the strings.
* @returns string denoting the addition of both the strings
*/
std::string add(const std::string &first, const std::string &second) {
std::string third;

View File

@ -28,10 +28,10 @@ struct std::is_unsigned<uint256_t> : std::true_type {};
/**
* @class uint256_t
* @brief class for 256-bit unsigned integer.
* @brief class for 256-bit unsigned integer
*/
class uint256_t {
uint128_t f{}, s{}; /// First and second half of 256 bit number.
uint128_t f{}, s{}; /// First and second half of 256 bit number
/**
* @brief Get integer from given string.
@ -65,6 +65,11 @@ class uint256_t {
// Constructors
uint256_t() = default;
/**
* @brief Parameterized constructor
* @tparam T template for integer types
* @param low Integer denoting lower 128-bits
*/
template <typename T, typename = typename std::enable_if<
std::is_integral<T>::value, T>::type>
explicit uint256_t(T low) : s(low), f(0) {}