-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuint512.h
46 lines (39 loc) · 1.28 KB
/
uint512.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2017 The PIVX Core developers
// Copyright (c) 2017-2019 The Vulcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UINT512_H
#define BITCOIN_UINT512_H
#include "arith_uint256.h"
#include "uint256.h"
/** 512-bit unsigned big integer. */
class uint512 : public base_blob<512>
{
public:
uint512() {}
uint512(const base_blob<512>& b) : base_blob<512>(b) {}
//explicit uint512(const std::vector<unsigned char>& vch) : base_uint<512>(vch) {}
explicit uint512(const std::vector<unsigned char>& vch) : base_blob<512>(vch) {}
//explicit uint512(const std::string& str) : base_blob<512>(str) {}
uint256 trim256() const
{
std::vector<unsigned char> vch;
const unsigned char* p = this->begin();
for (unsigned int i = 0; i < 32; i++) {
vch.push_back(*p++);
}
uint256 retval(vch);
return retval;
}
};
/* uint256 from const char *.
* This is a separate function because the constructor uint256(const char*) can result
* in dangerously catching uint256(0).
*/
inline uint512 uint512S(const char* str)
{
uint512 rv;
rv.SetHex(str);
return rv;
}
#endif // BITCOIN_UINT512_H