45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||
|
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
||
|
// Distributed under the MIT software license, see the accompanying
|
||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||
|
|
||
|
#ifndef BITCOIN_UINT256_H
|
||
|
#define BITCOIN_UINT256_H
|
||
|
|
||
|
#include <assert.h>
|
||
|
//#include <cstring>
|
||
|
//#include <stdexcept>
|
||
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
|
//#include <vector>
|
||
|
#include <stdbool.h>
|
||
|
|
||
|
|
||
|
|
||
|
/** 256-bit opaque blob.
|
||
|
* @note This type is called uint256 for historical reasons only. It is an
|
||
|
* opaque blob of 256 bits and has no integer operations. Use arith_uint256 if
|
||
|
* those are required.
|
||
|
*/
|
||
|
#define UPPER_P(x) x->elements[0]
|
||
|
#define LOWER_P(x) x->elements[1]
|
||
|
#define UPPER(x) x.elements[0]
|
||
|
#define LOWER(x) x.elements[1]
|
||
|
#define WIDTH 32
|
||
|
|
||
|
typedef struct class_base_blob base_blob_t;
|
||
|
struct class_base_blob{
|
||
|
uint8_t data[WIDTH];
|
||
|
};
|
||
|
|
||
|
|
||
|
typedef struct uint128_t { uint64_t elements[2]; } uint128_t;
|
||
|
typedef struct uint256_t {
|
||
|
uint128_t elements[2];
|
||
|
base_blob_t bb;
|
||
|
} uint256;
|
||
|
|
||
|
|
||
|
|
||
|
#endif // BITCOIN_UINT256_H
|