Bitcoin ABC 0.30.5
P2P Digital Currency
uint256radixkey.h
Go to the documentation of this file.
1// Copyright (c) 2022 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_UINT256RADIXKEY_H
6#define BITCOIN_UINT256RADIXKEY_H
7
8#include <arith_uint256.h>
9
10#include <cstdint>
11
12class uint256;
13
19
20 Uint256RadixKey(const uint256 &keyIn) : base(UintToArith256(keyIn)) {}
21 Uint256RadixKey(const base_uint<256> &keyIn) : base(keyIn) {}
22
23 Uint256RadixKey operator>>(uint32_t shift) const { return base >> shift; }
25 return base & mask.base;
26 }
27 operator size_t() const { return size_t(base.GetLow64()); }
28};
29
30// The radix tree relies on sizeof to gather the bit length of the key
31static_assert(sizeof(Uint256RadixKey) == 32,
32 "Uint256RadixKey key size should be 256 bits");
33
34#endif // BITCOIN_UINT256RADIXKEY_H
arith_uint256 UintToArith256(const uint256 &a)
256-bit unsigned big integer.
uint64_t GetLow64() const
256-bit opaque blob.
Definition: uint256.h:129
Facility for using an uint256 as a radix tree key.
Uint256RadixKey operator>>(uint32_t shift) const
Uint256RadixKey(const uint256 &keyIn)
Uint256RadixKey(const base_uint< 256 > &keyIn)
arith_uint256 base
Uint256RadixKey operator&(const Uint256RadixKey &mask) const