aboutsummaryrefslogtreecommitdiff
path: root/src/uint256.h
diff options
context:
space:
mode:
authorMichael Ford <fanquake@gmail.com>2014-10-31 08:43:19 +0800
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:44:21 +0100
commitfa94b9d5623cfd16aa594c28432f25a17b0efb0e (patch)
tree7c94530e14c0c3230883601157ab1cd81257806f /src/uint256.h
parentf2ada138c28bf6b4f4a668c4ab60b55d124c9823 (diff)
downloadbitcoin-fa94b9d5623cfd16aa594c28432f25a17b0efb0e.tar.xz
Convert remaining comments in /src to doxygen format
- Update comments in checkpoints to be doxygen compatible - Update comments in checkqueue to be doxygen compatible - Update coins to be doxygen compatible - Fix comment typo in crypter.h - Update licenses/copyright dates Closes #5325 #5184 #5183 #5182
Diffstat (limited to 'src/uint256.h')
-rw-r--r--src/uint256.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/uint256.h b/src/uint256.h
index 28de540226..56f7f44a16 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
-// Distributed under the MIT/X11 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.
#ifndef BITCOIN_UINT256_H
@@ -255,8 +255,10 @@ public:
return sizeof(pn);
}
- // Returns the position of the highest bit set plus one, or zero if the
- // value is zero.
+ /**
+ * Returns the position of the highest bit set plus one, or zero if the
+ * value is zero.
+ */
unsigned int bits() const;
uint64_t GetLow64() const
@@ -301,26 +303,27 @@ public:
uint256(uint64_t b) : base_uint<256>(b) {}
explicit uint256(const std::string& str) : base_uint<256>(str) {}
explicit uint256(const std::vector<unsigned char>& vch) : base_uint<256>(vch) {}
-
- // The "compact" format is a representation of a whole
- // number N using an unsigned 32bit number similar to a
- // floating point format.
- // The most significant 8 bits are the unsigned exponent of base 256.
- // This exponent can be thought of as "number of bytes of N".
- // The lower 23 bits are the mantissa.
- // Bit number 24 (0x800000) represents the sign of N.
- // N = (-1^sign) * mantissa * 256^(exponent-3)
- //
- // Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn().
- // MPI uses the most significant bit of the first byte as sign.
- // Thus 0x1234560000 is compact (0x05123456)
- // and 0xc0de000000 is compact (0x0600c0de)
- // (0x05c0de00) would be -0x40de000000
- //
- // Bitcoin only uses this "compact" format for encoding difficulty
- // targets, which are unsigned 256bit quantities. Thus, all the
- // complexities of the sign bit and using base 256 are probably an
- // implementation accident.
+
+ /**
+ * The "compact" format is a representation of a whole
+ * number N using an unsigned 32bit number similar to a
+ * floating point format.
+ * The most significant 8 bits are the unsigned exponent of base 256.
+ * This exponent can be thought of as "number of bytes of N".
+ * The lower 23 bits are the mantissa.
+ * Bit number 24 (0x800000) represents the sign of N.
+ * N = (-1^sign) * mantissa * 256^(exponent-3)
+ *
+ * Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn().
+ * MPI uses the most significant bit of the first byte as sign.
+ * Thus 0x1234560000 is compact (0x05123456)
+ * and 0xc0de000000 is compact (0x0600c0de)
+ *
+ * Bitcoin only uses this "compact" format for encoding difficulty
+ * targets, which are unsigned 256bit quantities. Thus, all the
+ * complexities of the sign bit and using base 256 are probably an
+ * implementation accident.
+ */
uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL);
uint32_t GetCompact(bool fNegative = false) const;