Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251*252* Bitcoin only uses this "compact" format for encoding difficulty253* targets, which are unsigned 256bit quantities. Thus, all the254* complexities of the sign bit and using base 256 are probably an255* implementation accident.256*/257arith_uint256& SetCompact(uint32_t nCompact, bool *pfNegative = nullptr, bool *pfOverflow = nullptr);258uint32_t GetCompact(bool fNegative = false) const;260friend uint256 ArithToUint256(const arith_uint256 &);261friend arith_uint256 UintToArith256(const uint256 &);262};264// Keeping the trivially copyable property is beneficial for performance265static_assert(std::is_trivially_copyable_v<arith_uint256>);267uint256 ArithToUint256(const arith_uint256 &);268arith_uint256 UintToArith256(const uint256 &);270extern template class base_uint<256>;272#endif // BITCOIN_ARITH_UINT256_H