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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// ---------------- [ File: bitcoin-compat/src/assumptions.rs ]
/*!
| Compile-time verification of assumptions we
| make.
|
| Some important things we are NOT assuming
| (non-exhaustive list):
|
| * We are NOT assuming a specific value for
| std::endian::native.
|
| * We are NOT assuming a specific value for
| std::locale("").name().
|
| * We are NOT assuming a specific value for
| std::numeric_limits<char>::is_signed.
*/
crateix!;
//-------------------------------------------[.cpp/bitcoin/src/compat/assumptions.h]
/**
| Assumption: We assume the floating-point types
| to fulfill the requirements of IEC
| 559 (IEEE 754) standard.
|
| Example(s): Floating-point division by zero in
| ConnectBlock, CreateTransaction and
| EstimateMedianVal.
*/
const_assert!// "IEEE 754 float assumed"
const_assert! // "IEEE 754 double assumed"
/**
| the “binary32” type defined in IEEE
| 754-2008
|
*/
const
/**
| the “binary64” type defined in IEEE
| 754-2008
|
*/
const
/**
| Assumption: We assume eight bits per byte
| (obviously, but remember: don't
| trust -- verify!).
|
| Example(s): Everywhere :-)
*/
const_assert! //"8-bit byte assumed"
/**
| Assumption: We assume integer widths.
|
| Example(s): GetSizeOfCompactSize and
| WriteCompactSize in the
| serialization code.
*/
const_assert! // "16-bit short assumed"
const_assert! // "32-bit int assumed"
const_assert! // "32-bit unsigned assumed"
/**
| Assumption: We assume size_t to be 32-bit or
| 64-bit.
|
| Example(s):
|
| size_t assumed to be at least 32-bit in
| ecdsa_signature_parse_der_lax(...).
|
| size_t assumed to be 32-bit or 64-bit in
| MallocUsage(...).
*/
const_assert!
/**
| "Sizes of size_t and c_void* assumed to
| be equal"
|
*/
const_assert!