Changeset View
Changeset View
Standalone View
Standalone View
src/arith_uint256.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <arith_uint256.h> | #include <arith_uint256.h> | ||||
#include <crypto/common.h> | #include <crypto/common.h> | ||||
#include <uint256.h> | #include <uint256.h> | ||||
#include <utilstrencodings.h> | #include <utilstrencodings.h> | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstring> | #include <cstring> | ||||
template <unsigned int BITS> | template <unsigned int BITS> | ||||
base_uint<BITS>::base_uint(const std::string &str) { | base_uint<BITS>::base_uint(const std::string &str) { | ||||
static_assert(BITS / 32 > 0 && BITS % 32 == 0, | |||||
"Template parameter BITS must be a positive multiple of 32."); | |||||
SetHex(str); | SetHex(str); | ||||
} | } | ||||
template <unsigned int BITS> | template <unsigned int BITS> | ||||
base_uint<BITS> &base_uint<BITS>::operator<<=(unsigned int shift) { | base_uint<BITS> &base_uint<BITS>::operator<<=(unsigned int shift) { | ||||
base_uint<BITS> a(*this); | base_uint<BITS> a(*this); | ||||
for (int i = 0; i < WIDTH; i++) | for (int i = 0; i < WIDTH; i++) | ||||
pn[i] = 0; | pn[i] = 0; | ||||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |