prettier-plugin-solidity 1.0.0-beta.19 → 1.0.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -13
- package/package.json +13 -13
- package/prettier-plugin-solidity-1.0.0-beta.19.tgz +0 -0
- package/src/binary-operator-printers/index.js +1 -1
- package/src/nodes/Continue.js +5 -0
- package/src/nodes/FunctionCall.js +17 -14
- package/src/nodes/InlineAssemblyStatement.js +17 -1
- package/src/nodes/ModifierDefinition.js +5 -3
- package/src/nodes/UsingForDeclaration.js +19 -3
- package/src/nodes/index.js +2 -2
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -23
- package/.github/workflows/CI.yml +0 -83
- package/assets/telegram-badge.svg +0 -29
- package/scripts/generateIndexes.js +0 -16
- package/scripts/makeData.js +0 -23
- package/src/nodes/TypeNameExpression.js +0 -5
- package/tests/config/.prettierrc +0 -5
- package/tests/config/format-test.js +0 -458
- package/tests/config/require-prettier.js +0 -5
- package/tests/config/require-standalone.js +0 -25
- package/tests/config/setup.js +0 -7
- package/tests/config/utils/check-parsers.js +0 -207
- package/tests/config/utils/compile-contract.js +0 -36
- package/tests/config/utils/consistent-end-of-line.js +0 -13
- package/tests/config/utils/create-snapshot.js +0 -98
- package/tests/config/utils/stringify-options-for-title.js +0 -15
- package/tests/config/utils/visualize-end-of-line.js +0 -18
- package/tests/config/utils/visualize-range.js +0 -40
- package/tests/format/AddressPayable/AddressPayable.sol +0 -10
- package/tests/format/AddressPayable/__snapshots__/jsfmt.spec.js.snap +0 -37
- package/tests/format/AddressPayable/jsfmt.spec.js +0 -1
- package/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol +0 -533
- package/tests/format/AllSolidityFeatures/__snapshots__/jsfmt.spec.js.snap +0 -1146
- package/tests/format/AllSolidityFeatures/jsfmt.spec.js +0 -1
- package/tests/format/Arrays/Arrays.sol +0 -17
- package/tests/format/Arrays/__snapshots__/jsfmt.spec.js.snap +0 -63
- package/tests/format/Arrays/jsfmt.spec.js +0 -1
- package/tests/format/Assembly/Assembly.sol +0 -180
- package/tests/format/Assembly/__snapshots__/jsfmt.spec.js.snap +0 -406
- package/tests/format/Assembly/jsfmt.spec.js +0 -1
- package/tests/format/BasicIterator/BasicIterator.sol +0 -44
- package/tests/format/BasicIterator/__snapshots__/jsfmt.spec.js.snap +0 -102
- package/tests/format/BasicIterator/jsfmt.spec.js +0 -1
- package/tests/format/BinaryOperators/BinaryOperators.sol +0 -186
- package/tests/format/BinaryOperators/Parentheses.sol +0 -132
- package/tests/format/BinaryOperators/__snapshots__/jsfmt.spec.js.snap +0 -952
- package/tests/format/BinaryOperators/jsfmt.spec.js +0 -1
- package/tests/format/BreakingChangesV0.7.4/BreakingChangesV0.7.4.sol +0 -9
- package/tests/format/BreakingChangesV0.7.4/__snapshots__/jsfmt.spec.js.snap +0 -198
- package/tests/format/BreakingChangesV0.7.4/jsfmt.spec.js +0 -14
- package/tests/format/BreakingChangesV0.8.0/BreakingChangesV0.8.0.sol +0 -43
- package/tests/format/BreakingChangesV0.8.0/__snapshots__/jsfmt.spec.js.snap +0 -815
- package/tests/format/BreakingChangesV0.8.0/jsfmt.spec.js +0 -26
- package/tests/format/Comments/Comments.sol +0 -104
- package/tests/format/Comments/__snapshots__/jsfmt.spec.js.snap +0 -244
- package/tests/format/Comments/jsfmt.spec.js +0 -1
- package/tests/format/Conditional/Conditional.sol +0 -26
- package/tests/format/Conditional/__snapshots__/jsfmt.spec.js.snap +0 -80
- package/tests/format/Conditional/jsfmt.spec.js +0 -1
- package/tests/format/Constructors/Constructors.sol +0 -8
- package/tests/format/Constructors/__snapshots__/jsfmt.spec.js.snap +0 -54
- package/tests/format/Constructors/jsfmt.spec.js +0 -1
- package/tests/format/ContractDefinitions/ContractDefinitions.sol +0 -2
- package/tests/format/ContractDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -22
- package/tests/format/ContractDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/CustomErrors/CustomErrors.sol +0 -20
- package/tests/format/CustomErrors/__snapshots__/jsfmt.spec.js.snap +0 -50
- package/tests/format/CustomErrors/jsfmt.spec.js +0 -1
- package/tests/format/EnumDefinitions/EnumDefinitions.sol +0 -4
- package/tests/format/EnumDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -72
- package/tests/format/EnumDefinitions/jsfmt.spec.js +0 -2
- package/tests/format/Etc/Etc.sol +0 -48
- package/tests/format/Etc/__snapshots__/jsfmt.spec.js.snap +0 -134
- package/tests/format/Etc/jsfmt.spec.js +0 -1
- package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +0 -36
- package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +0 -258
- package/tests/format/ExplicitVariableTypes/jsfmt.spec.js +0 -9
- package/tests/format/ForStatements/ForStatements.sol +0 -43
- package/tests/format/ForStatements/__snapshots__/jsfmt.spec.js.snap +0 -108
- package/tests/format/ForStatements/jsfmt.spec.js +0 -1
- package/tests/format/FunctionCalls/FunctionCalls.sol +0 -40
- package/tests/format/FunctionCalls/__snapshots__/jsfmt.spec.js.snap +0 -310
- package/tests/format/FunctionCalls/jsfmt.spec.js +0 -2
- package/tests/format/FunctionDefinitions/FunctionDefinitions.sol +0 -169
- package/tests/format/FunctionDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -875
- package/tests/format/FunctionDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/HexLiteral/HexLiteral.sol +0 -7
- package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +0 -57
- package/tests/format/HexLiteral/jsfmt.spec.js +0 -8
- package/tests/format/IfStatements/IfStatements.sol +0 -112
- package/tests/format/IfStatements/__snapshots__/jsfmt.spec.js.snap +0 -534
- package/tests/format/IfStatements/jsfmt.spec.js +0 -1
- package/tests/format/Immutable/Immutable.sol +0 -20
- package/tests/format/Immutable/__snapshots__/jsfmt.spec.js.snap +0 -53
- package/tests/format/Immutable/jsfmt.spec.js +0 -1
- package/tests/format/ImportDirective/ImportDirectives.sol +0 -5
- package/tests/format/ImportDirective/__snapshots__/jsfmt.spec.js.snap +0 -46
- package/tests/format/ImportDirective/jsfmt.spec.js +0 -2
- package/tests/format/Inbox/Inbox.sol +0 -33
- package/tests/format/Inbox/__snapshots__/jsfmt.spec.js.snap +0 -79
- package/tests/format/Inbox/jsfmt.spec.js +0 -1
- package/tests/format/IndexOf/IndexOf.sol +0 -67
- package/tests/format/IndexOf/__snapshots__/jsfmt.spec.js.snap +0 -144
- package/tests/format/IndexOf/jsfmt.spec.js +0 -1
- package/tests/format/IndexRangeAccess/IndexRangeAccess.sol +0 -9
- package/tests/format/IndexRangeAccess/__snapshots__/jsfmt.spec.js.snap +0 -31
- package/tests/format/IndexRangeAccess/jsfmt.spec.js +0 -1
- package/tests/format/InheritanceSpecifier/InheritanceSpecifier.sol +0 -2
- package/tests/format/InheritanceSpecifier/__snapshots__/jsfmt.spec.js.snap +0 -24
- package/tests/format/InheritanceSpecifier/jsfmt.spec.js +0 -1
- package/tests/format/Issues/Issue205.sol +0 -12
- package/tests/format/Issues/Issue289.sol +0 -6
- package/tests/format/Issues/Issue355.sol +0 -12
- package/tests/format/Issues/Issue385.sol +0 -13
- package/tests/format/Issues/Issue564.sol +0 -9
- package/tests/format/Issues/__snapshots__/jsfmt.spec.js.snap +0 -174
- package/tests/format/Issues/jsfmt.spec.js +0 -1
- package/tests/format/MemberAccess/MemberAccess.sol +0 -102
- package/tests/format/MemberAccess/__snapshots__/jsfmt.spec.js.snap +0 -243
- package/tests/format/MemberAccess/jsfmt.spec.js +0 -1
- package/tests/format/ModifierDefinitions/ModifierDefinitions.sol +0 -6
- package/tests/format/ModifierDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -29
- package/tests/format/ModifierDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/ModifierInvocations/ModifierInvocations.sol +0 -17
- package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +0 -51
- package/tests/format/ModifierInvocations/jsfmt.spec.js +0 -1
- package/tests/format/MultipartStrings/MultipartStrings.sol +0 -10
- package/tests/format/MultipartStrings/__snapshots__/jsfmt.spec.js.snap +0 -39
- package/tests/format/MultipartStrings/jsfmt.spec.js +0 -1
- package/tests/format/NameValueExpression/NameValueExpression.sol +0 -6
- package/tests/format/NameValueExpression/__snapshots__/jsfmt.spec.js.snap +0 -68
- package/tests/format/NameValueExpression/jsfmt.spec.js +0 -2
- package/tests/format/Ownable/Ownable.sol +0 -75
- package/tests/format/Ownable/__snapshots__/jsfmt.spec.js.snap +0 -163
- package/tests/format/Ownable/jsfmt.spec.js +0 -1
- package/tests/format/Parentheses/AddNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitAndNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitOrNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitXorNoParentheses.sol +0 -92
- package/tests/format/Parentheses/DivNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ExpNoParentheses.sol +0 -92
- package/tests/format/Parentheses/LogicNoParentheses.sol +0 -20
- package/tests/format/Parentheses/ModNoParentheses.sol +0 -92
- package/tests/format/Parentheses/MulNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftLNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftRNoParentheses.sol +0 -92
- package/tests/format/Parentheses/SubNoParentheses.sol +0 -92
- package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +0 -2237
- package/tests/format/Parentheses/jsfmt.spec.js +0 -1
- package/tests/format/Pragma/Pragma.sol +0 -8
- package/tests/format/Pragma/__snapshots__/jsfmt.spec.js.snap +0 -29
- package/tests/format/Pragma/jsfmt.spec.js +0 -1
- package/tests/format/PrettierIgnore/PrettierIgnore.sol +0 -39
- package/tests/format/PrettierIgnore/__snapshots__/jsfmt.spec.js.snap +0 -87
- package/tests/format/PrettierIgnore/jsfmt.spec.js +0 -1
- package/tests/format/Proxy/Proxy.sol +0 -52
- package/tests/format/Proxy/__snapshots__/jsfmt.spec.js.snap +0 -127
- package/tests/format/Proxy/jsfmt.spec.js +0 -1
- package/tests/format/RespectDefaultOptions/__snapshots__/jsfmt.spec.js.snap +0 -19
- package/tests/format/RespectDefaultOptions/jsfmt.spec.js +0 -5
- package/tests/format/RespectDefaultOptions/respect-default-options.js +0 -3
- package/tests/format/SampleCrowdsale/SampleCrowdsale.sol +0 -48
- package/tests/format/SampleCrowdsale/__snapshots__/jsfmt.spec.js.snap +0 -113
- package/tests/format/SampleCrowdsale/jsfmt.spec.js +0 -1
- package/tests/format/SimpleAuction/SimpleAuction.sol +0 -123
- package/tests/format/SimpleAuction/__snapshots__/jsfmt.spec.js.snap +0 -250
- package/tests/format/SimpleAuction/jsfmt.spec.js +0 -1
- package/tests/format/SimpleStorage/SimpleStorage.sol +0 -14
- package/tests/format/SimpleStorage/__snapshots__/jsfmt.spec.js.snap +0 -41
- package/tests/format/SimpleStorage/jsfmt.spec.js +0 -1
- package/tests/format/SplittableCommodity/SplittableCommodity.sol +0 -57
- package/tests/format/SplittableCommodity/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/SplittableCommodity/jsfmt.spec.js +0 -1
- package/tests/format/StateVariableDeclarations/StateVariableDeclarations.sol +0 -3
- package/tests/format/StateVariableDeclarations/__snapshots__/jsfmt.spec.js.snap +0 -20
- package/tests/format/StateVariableDeclarations/jsfmt.spec.js +0 -1
- package/tests/format/StringLiteral/StringLiteral.sol +0 -11
- package/tests/format/StringLiteral/__snapshots__/jsfmt.spec.js.snap +0 -36
- package/tests/format/StringLiteral/jsfmt.spec.js +0 -1
- package/tests/format/StyleGuide/BlankLines.sol +0 -19
- package/tests/format/StyleGuide/ControlStructures.sol +0 -57
- package/tests/format/StyleGuide/FunctionDeclaration.sol +0 -135
- package/tests/format/StyleGuide/Mappings.sol +0 -9
- package/tests/format/StyleGuide/MaximumLineLength.sol +0 -67
- package/tests/format/StyleGuide/OtherRecommendations.sol +0 -29
- package/tests/format/StyleGuide/VariableDeclarations.sol +0 -6
- package/tests/format/StyleGuide/WhitespaceInExpressions.sol +0 -13
- package/tests/format/StyleGuide/__snapshots__/jsfmt.spec.js.snap +0 -772
- package/tests/format/StyleGuide/jsfmt.spec.js +0 -1
- package/tests/format/TryCatch/TryCatch.sol +0 -103
- package/tests/format/TryCatch/__snapshots__/jsfmt.spec.js.snap +0 -241
- package/tests/format/TryCatch/jsfmt.spec.js +0 -1
- package/tests/format/Tupples/Tupples.sol +0 -25
- package/tests/format/Tupples/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/Tupples/jsfmt.spec.js +0 -1
- package/tests/format/TypeDefinition/TypeDefinition.sol +0 -12
- package/tests/format/TypeDefinition/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/TypeDefinition/jsfmt.spec.js +0 -1
- package/tests/format/WhileStatements/WhileStatements.sol +0 -37
- package/tests/format/WhileStatements/__snapshots__/jsfmt.spec.js.snap +0 -110
- package/tests/format/WhileStatements/jsfmt.spec.js +0 -1
- package/tests/format/WrongCompiler/WrongCompiler.sol +0 -3
- package/tests/format/WrongCompiler/__snapshots__/jsfmt.spec.js.snap +0 -55
- package/tests/format/WrongCompiler/jsfmt.spec.js +0 -10
- package/tests/format/quotes/Quotes.sol +0 -24
- package/tests/format/quotes/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/quotes/jsfmt.spec.js +0 -2
- package/tests/format/strings/__snapshots__/jsfmt.spec.js.snap +0 -1579
- package/tests/format/strings/jsfmt.spec.js +0 -1
- package/tests/format/strings/strings.sol +0 -717
- package/tests/unit/binary-operator-printers/__snapshots__/index.test.js.snap +0 -13
- package/tests/unit/binary-operator-printers/index.test.js +0 -5
- package/tests/unit/comments/printer.test.js +0 -9
- package/tests/unit/prettier-version.test.js +0 -26
- package/tests/unit/printer.test.js +0 -9
|
@@ -1,2237 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`AddNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
4
|
-
====================================options=====================================
|
|
5
|
-
compiler: "0.8.6"
|
|
6
|
-
parsers: ["solidity-parse"]
|
|
7
|
-
printWidth: 80
|
|
8
|
-
| printWidth
|
|
9
|
-
=====================================input======================================
|
|
10
|
-
// SPDX-License-Identifier: MIT
|
|
11
|
-
pragma solidity 0.8.10;
|
|
12
|
-
|
|
13
|
-
contract AddNoParentheses {
|
|
14
|
-
function addAdd(uint256 a, uint256 b, uint256 c)
|
|
15
|
-
public
|
|
16
|
-
pure
|
|
17
|
-
returns (uint256)
|
|
18
|
-
{
|
|
19
|
-
return a + b + c;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function addSub(uint256 a, uint256 b, uint256 c)
|
|
23
|
-
public
|
|
24
|
-
pure
|
|
25
|
-
returns (uint256)
|
|
26
|
-
{
|
|
27
|
-
return a + b - c;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function addMul(uint256 a, uint256 b, uint256 c)
|
|
31
|
-
public
|
|
32
|
-
pure
|
|
33
|
-
returns (uint256)
|
|
34
|
-
{
|
|
35
|
-
return a + b * c;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function addDiv(uint256 a, uint256 b, uint256 c)
|
|
39
|
-
public
|
|
40
|
-
pure
|
|
41
|
-
returns (uint256)
|
|
42
|
-
{
|
|
43
|
-
return a + b / c;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function addMod(uint256 a, uint256 b, uint256 c)
|
|
47
|
-
public
|
|
48
|
-
pure
|
|
49
|
-
returns (uint256)
|
|
50
|
-
{
|
|
51
|
-
return a + b % c;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function addExp(uint256 a, uint256 b, uint256 c)
|
|
55
|
-
public
|
|
56
|
-
pure
|
|
57
|
-
returns (uint256)
|
|
58
|
-
{
|
|
59
|
-
return a + b ** c;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function addShiftL(uint256 a, uint256 b, uint256 c)
|
|
63
|
-
public
|
|
64
|
-
pure
|
|
65
|
-
returns (uint256)
|
|
66
|
-
{
|
|
67
|
-
return a + b << c;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function addShiftR(uint256 a, uint256 b, uint256 c)
|
|
71
|
-
public
|
|
72
|
-
pure
|
|
73
|
-
returns (uint256)
|
|
74
|
-
{
|
|
75
|
-
return a + b >> c;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function addBitAnd(uint256 a, uint256 b, uint256 c)
|
|
79
|
-
public
|
|
80
|
-
pure
|
|
81
|
-
returns (uint256)
|
|
82
|
-
{
|
|
83
|
-
return a + b & c;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function addBitOr(uint256 a, uint256 b, uint256 c)
|
|
87
|
-
public
|
|
88
|
-
pure
|
|
89
|
-
returns (uint256)
|
|
90
|
-
{
|
|
91
|
-
return a + b | c;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function addBitXor(uint256 a, uint256 b, uint256 c)
|
|
95
|
-
public
|
|
96
|
-
pure
|
|
97
|
-
returns (uint256)
|
|
98
|
-
{
|
|
99
|
-
return a + b ^ c;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
=====================================output=====================================
|
|
104
|
-
// SPDX-License-Identifier: MIT
|
|
105
|
-
pragma solidity 0.8.10;
|
|
106
|
-
|
|
107
|
-
contract AddNoParentheses {
|
|
108
|
-
function addAdd(
|
|
109
|
-
uint256 a,
|
|
110
|
-
uint256 b,
|
|
111
|
-
uint256 c
|
|
112
|
-
) public pure returns (uint256) {
|
|
113
|
-
return a + b + c;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function addSub(
|
|
117
|
-
uint256 a,
|
|
118
|
-
uint256 b,
|
|
119
|
-
uint256 c
|
|
120
|
-
) public pure returns (uint256) {
|
|
121
|
-
return a + b - c;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function addMul(
|
|
125
|
-
uint256 a,
|
|
126
|
-
uint256 b,
|
|
127
|
-
uint256 c
|
|
128
|
-
) public pure returns (uint256) {
|
|
129
|
-
return a + b * c;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function addDiv(
|
|
133
|
-
uint256 a,
|
|
134
|
-
uint256 b,
|
|
135
|
-
uint256 c
|
|
136
|
-
) public pure returns (uint256) {
|
|
137
|
-
return a + b / c;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function addMod(
|
|
141
|
-
uint256 a,
|
|
142
|
-
uint256 b,
|
|
143
|
-
uint256 c
|
|
144
|
-
) public pure returns (uint256) {
|
|
145
|
-
return a + (b % c);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function addExp(
|
|
149
|
-
uint256 a,
|
|
150
|
-
uint256 b,
|
|
151
|
-
uint256 c
|
|
152
|
-
) public pure returns (uint256) {
|
|
153
|
-
return a + b**c;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function addShiftL(
|
|
157
|
-
uint256 a,
|
|
158
|
-
uint256 b,
|
|
159
|
-
uint256 c
|
|
160
|
-
) public pure returns (uint256) {
|
|
161
|
-
return (a + b) << c;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function addShiftR(
|
|
165
|
-
uint256 a,
|
|
166
|
-
uint256 b,
|
|
167
|
-
uint256 c
|
|
168
|
-
) public pure returns (uint256) {
|
|
169
|
-
return (a + b) >> c;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function addBitAnd(
|
|
173
|
-
uint256 a,
|
|
174
|
-
uint256 b,
|
|
175
|
-
uint256 c
|
|
176
|
-
) public pure returns (uint256) {
|
|
177
|
-
return (a + b) & c;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function addBitOr(
|
|
181
|
-
uint256 a,
|
|
182
|
-
uint256 b,
|
|
183
|
-
uint256 c
|
|
184
|
-
) public pure returns (uint256) {
|
|
185
|
-
return (a + b) | c;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function addBitXor(
|
|
189
|
-
uint256 a,
|
|
190
|
-
uint256 b,
|
|
191
|
-
uint256 c
|
|
192
|
-
) public pure returns (uint256) {
|
|
193
|
-
return (a + b) ^ c;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
================================================================================
|
|
198
|
-
`;
|
|
199
|
-
|
|
200
|
-
exports[`BitAndNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
201
|
-
====================================options=====================================
|
|
202
|
-
compiler: "0.8.6"
|
|
203
|
-
parsers: ["solidity-parse"]
|
|
204
|
-
printWidth: 80
|
|
205
|
-
| printWidth
|
|
206
|
-
=====================================input======================================
|
|
207
|
-
// SPDX-License-Identifier: MIT
|
|
208
|
-
pragma solidity 0.8.10;
|
|
209
|
-
|
|
210
|
-
contract BitAndNoParentheses {
|
|
211
|
-
function bitAndAdd(uint256 a, uint256 b, uint256 c)
|
|
212
|
-
public
|
|
213
|
-
pure
|
|
214
|
-
returns (uint256)
|
|
215
|
-
{
|
|
216
|
-
return a & b + c;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function bitAndSub(uint256 a, uint256 b, uint256 c)
|
|
220
|
-
public
|
|
221
|
-
pure
|
|
222
|
-
returns (uint256)
|
|
223
|
-
{
|
|
224
|
-
return a & b - c;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function bitAndMul(uint256 a, uint256 b, uint256 c)
|
|
228
|
-
public
|
|
229
|
-
pure
|
|
230
|
-
returns (uint256)
|
|
231
|
-
{
|
|
232
|
-
return a & b * c;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function bitAndDiv(uint256 a, uint256 b, uint256 c)
|
|
236
|
-
public
|
|
237
|
-
pure
|
|
238
|
-
returns (uint256)
|
|
239
|
-
{
|
|
240
|
-
return a & b / c;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function bitAndMod(uint256 a, uint256 b, uint256 c)
|
|
244
|
-
public
|
|
245
|
-
pure
|
|
246
|
-
returns (uint256)
|
|
247
|
-
{
|
|
248
|
-
return a & b % c;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function bitAndExp(uint256 a, uint256 b, uint256 c)
|
|
252
|
-
public
|
|
253
|
-
pure
|
|
254
|
-
returns (uint256)
|
|
255
|
-
{
|
|
256
|
-
return a & b ** c;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function bitAndShiftL(uint256 a, uint256 b, uint256 c)
|
|
260
|
-
public
|
|
261
|
-
pure
|
|
262
|
-
returns (uint256)
|
|
263
|
-
{
|
|
264
|
-
return a & b << c;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function bitAndShiftR(uint256 a, uint256 b, uint256 c)
|
|
268
|
-
public
|
|
269
|
-
pure
|
|
270
|
-
returns (uint256)
|
|
271
|
-
{
|
|
272
|
-
return a & b >> c;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function bitAndBitAnd(uint256 a, uint256 b, uint256 c)
|
|
276
|
-
public
|
|
277
|
-
pure
|
|
278
|
-
returns (uint256)
|
|
279
|
-
{
|
|
280
|
-
return a & b & c;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function bitAndBitOr(uint256 a, uint256 b, uint256 c)
|
|
284
|
-
public
|
|
285
|
-
pure
|
|
286
|
-
returns (uint256)
|
|
287
|
-
{
|
|
288
|
-
return a & b | c;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function bitAndBitXor(uint256 a, uint256 b, uint256 c)
|
|
292
|
-
public
|
|
293
|
-
pure
|
|
294
|
-
returns (uint256)
|
|
295
|
-
{
|
|
296
|
-
return a & b ^ c;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
=====================================output=====================================
|
|
301
|
-
// SPDX-License-Identifier: MIT
|
|
302
|
-
pragma solidity 0.8.10;
|
|
303
|
-
|
|
304
|
-
contract BitAndNoParentheses {
|
|
305
|
-
function bitAndAdd(
|
|
306
|
-
uint256 a,
|
|
307
|
-
uint256 b,
|
|
308
|
-
uint256 c
|
|
309
|
-
) public pure returns (uint256) {
|
|
310
|
-
return a & (b + c);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function bitAndSub(
|
|
314
|
-
uint256 a,
|
|
315
|
-
uint256 b,
|
|
316
|
-
uint256 c
|
|
317
|
-
) public pure returns (uint256) {
|
|
318
|
-
return a & (b - c);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function bitAndMul(
|
|
322
|
-
uint256 a,
|
|
323
|
-
uint256 b,
|
|
324
|
-
uint256 c
|
|
325
|
-
) public pure returns (uint256) {
|
|
326
|
-
return a & (b * c);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function bitAndDiv(
|
|
330
|
-
uint256 a,
|
|
331
|
-
uint256 b,
|
|
332
|
-
uint256 c
|
|
333
|
-
) public pure returns (uint256) {
|
|
334
|
-
return a & (b / c);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function bitAndMod(
|
|
338
|
-
uint256 a,
|
|
339
|
-
uint256 b,
|
|
340
|
-
uint256 c
|
|
341
|
-
) public pure returns (uint256) {
|
|
342
|
-
return a & b % c;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function bitAndExp(
|
|
346
|
-
uint256 a,
|
|
347
|
-
uint256 b,
|
|
348
|
-
uint256 c
|
|
349
|
-
) public pure returns (uint256) {
|
|
350
|
-
return a & (b**c);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function bitAndShiftL(
|
|
354
|
-
uint256 a,
|
|
355
|
-
uint256 b,
|
|
356
|
-
uint256 c
|
|
357
|
-
) public pure returns (uint256) {
|
|
358
|
-
return a & (b << c);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function bitAndShiftR(
|
|
362
|
-
uint256 a,
|
|
363
|
-
uint256 b,
|
|
364
|
-
uint256 c
|
|
365
|
-
) public pure returns (uint256) {
|
|
366
|
-
return a & (b >> c);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function bitAndBitAnd(
|
|
370
|
-
uint256 a,
|
|
371
|
-
uint256 b,
|
|
372
|
-
uint256 c
|
|
373
|
-
) public pure returns (uint256) {
|
|
374
|
-
return a & b & c;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function bitAndBitOr(
|
|
378
|
-
uint256 a,
|
|
379
|
-
uint256 b,
|
|
380
|
-
uint256 c
|
|
381
|
-
) public pure returns (uint256) {
|
|
382
|
-
return (a & b) | c;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function bitAndBitXor(
|
|
386
|
-
uint256 a,
|
|
387
|
-
uint256 b,
|
|
388
|
-
uint256 c
|
|
389
|
-
) public pure returns (uint256) {
|
|
390
|
-
return (a & b) ^ c;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
================================================================================
|
|
395
|
-
`;
|
|
396
|
-
|
|
397
|
-
exports[`BitOrNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
398
|
-
====================================options=====================================
|
|
399
|
-
compiler: "0.8.6"
|
|
400
|
-
parsers: ["solidity-parse"]
|
|
401
|
-
printWidth: 80
|
|
402
|
-
| printWidth
|
|
403
|
-
=====================================input======================================
|
|
404
|
-
// SPDX-License-Identifier: MIT
|
|
405
|
-
pragma solidity 0.8.10;
|
|
406
|
-
|
|
407
|
-
contract BitOrNoParentheses {
|
|
408
|
-
function bitOrAdd(uint256 a, uint256 b, uint256 c)
|
|
409
|
-
public
|
|
410
|
-
pure
|
|
411
|
-
returns (uint256)
|
|
412
|
-
{
|
|
413
|
-
return a | b + c;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function bitOrSub(uint256 a, uint256 b, uint256 c)
|
|
417
|
-
public
|
|
418
|
-
pure
|
|
419
|
-
returns (uint256)
|
|
420
|
-
{
|
|
421
|
-
return a | b - c;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function bitOrMul(uint256 a, uint256 b, uint256 c)
|
|
425
|
-
public
|
|
426
|
-
pure
|
|
427
|
-
returns (uint256)
|
|
428
|
-
{
|
|
429
|
-
return a | b * c;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function bitOrDiv(uint256 a, uint256 b, uint256 c)
|
|
433
|
-
public
|
|
434
|
-
pure
|
|
435
|
-
returns (uint256)
|
|
436
|
-
{
|
|
437
|
-
return a | b / c;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function bitOrMod(uint256 a, uint256 b, uint256 c)
|
|
441
|
-
public
|
|
442
|
-
pure
|
|
443
|
-
returns (uint256)
|
|
444
|
-
{
|
|
445
|
-
return a | b % c;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function bitOrExp(uint256 a, uint256 b, uint256 c)
|
|
449
|
-
public
|
|
450
|
-
pure
|
|
451
|
-
returns (uint256)
|
|
452
|
-
{
|
|
453
|
-
return a | b ** c;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function bitOrShiftL(uint256 a, uint256 b, uint256 c)
|
|
457
|
-
public
|
|
458
|
-
pure
|
|
459
|
-
returns (uint256)
|
|
460
|
-
{
|
|
461
|
-
return a | b << c;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function bitOrShiftR(uint256 a, uint256 b, uint256 c)
|
|
465
|
-
public
|
|
466
|
-
pure
|
|
467
|
-
returns (uint256)
|
|
468
|
-
{
|
|
469
|
-
return a | b >> c;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
function bitOrBitAnd(uint256 a, uint256 b, uint256 c)
|
|
473
|
-
public
|
|
474
|
-
pure
|
|
475
|
-
returns (uint256)
|
|
476
|
-
{
|
|
477
|
-
return a | b & c;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function bitOrBitOr(uint256 a, uint256 b, uint256 c)
|
|
481
|
-
public
|
|
482
|
-
pure
|
|
483
|
-
returns (uint256)
|
|
484
|
-
{
|
|
485
|
-
return a | b | c;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
function bitOrBitXor(uint256 a, uint256 b, uint256 c)
|
|
489
|
-
public
|
|
490
|
-
pure
|
|
491
|
-
returns (uint256)
|
|
492
|
-
{
|
|
493
|
-
return a | b ^ c;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
=====================================output=====================================
|
|
498
|
-
// SPDX-License-Identifier: MIT
|
|
499
|
-
pragma solidity 0.8.10;
|
|
500
|
-
|
|
501
|
-
contract BitOrNoParentheses {
|
|
502
|
-
function bitOrAdd(
|
|
503
|
-
uint256 a,
|
|
504
|
-
uint256 b,
|
|
505
|
-
uint256 c
|
|
506
|
-
) public pure returns (uint256) {
|
|
507
|
-
return a | (b + c);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function bitOrSub(
|
|
511
|
-
uint256 a,
|
|
512
|
-
uint256 b,
|
|
513
|
-
uint256 c
|
|
514
|
-
) public pure returns (uint256) {
|
|
515
|
-
return a | (b - c);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
function bitOrMul(
|
|
519
|
-
uint256 a,
|
|
520
|
-
uint256 b,
|
|
521
|
-
uint256 c
|
|
522
|
-
) public pure returns (uint256) {
|
|
523
|
-
return a | (b * c);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function bitOrDiv(
|
|
527
|
-
uint256 a,
|
|
528
|
-
uint256 b,
|
|
529
|
-
uint256 c
|
|
530
|
-
) public pure returns (uint256) {
|
|
531
|
-
return a | (b / c);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
function bitOrMod(
|
|
535
|
-
uint256 a,
|
|
536
|
-
uint256 b,
|
|
537
|
-
uint256 c
|
|
538
|
-
) public pure returns (uint256) {
|
|
539
|
-
return a | b % c;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function bitOrExp(
|
|
543
|
-
uint256 a,
|
|
544
|
-
uint256 b,
|
|
545
|
-
uint256 c
|
|
546
|
-
) public pure returns (uint256) {
|
|
547
|
-
return a | (b**c);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
function bitOrShiftL(
|
|
551
|
-
uint256 a,
|
|
552
|
-
uint256 b,
|
|
553
|
-
uint256 c
|
|
554
|
-
) public pure returns (uint256) {
|
|
555
|
-
return a | (b << c);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function bitOrShiftR(
|
|
559
|
-
uint256 a,
|
|
560
|
-
uint256 b,
|
|
561
|
-
uint256 c
|
|
562
|
-
) public pure returns (uint256) {
|
|
563
|
-
return a | (b >> c);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
function bitOrBitAnd(
|
|
567
|
-
uint256 a,
|
|
568
|
-
uint256 b,
|
|
569
|
-
uint256 c
|
|
570
|
-
) public pure returns (uint256) {
|
|
571
|
-
return a | (b & c);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function bitOrBitOr(
|
|
575
|
-
uint256 a,
|
|
576
|
-
uint256 b,
|
|
577
|
-
uint256 c
|
|
578
|
-
) public pure returns (uint256) {
|
|
579
|
-
return a | b | c;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function bitOrBitXor(
|
|
583
|
-
uint256 a,
|
|
584
|
-
uint256 b,
|
|
585
|
-
uint256 c
|
|
586
|
-
) public pure returns (uint256) {
|
|
587
|
-
return a | (b ^ c);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
================================================================================
|
|
592
|
-
`;
|
|
593
|
-
|
|
594
|
-
exports[`BitXorNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
595
|
-
====================================options=====================================
|
|
596
|
-
compiler: "0.8.6"
|
|
597
|
-
parsers: ["solidity-parse"]
|
|
598
|
-
printWidth: 80
|
|
599
|
-
| printWidth
|
|
600
|
-
=====================================input======================================
|
|
601
|
-
// SPDX-License-Identifier: MIT
|
|
602
|
-
pragma solidity 0.8.10;
|
|
603
|
-
|
|
604
|
-
contract BitXorNoParentheses {
|
|
605
|
-
function bitXorAdd(uint256 a, uint256 b, uint256 c)
|
|
606
|
-
public
|
|
607
|
-
pure
|
|
608
|
-
returns (uint256)
|
|
609
|
-
{
|
|
610
|
-
return a ^ b + c;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
function bitXorSub(uint256 a, uint256 b, uint256 c)
|
|
614
|
-
public
|
|
615
|
-
pure
|
|
616
|
-
returns (uint256)
|
|
617
|
-
{
|
|
618
|
-
return a ^ b - c;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
function bitXorMul(uint256 a, uint256 b, uint256 c)
|
|
622
|
-
public
|
|
623
|
-
pure
|
|
624
|
-
returns (uint256)
|
|
625
|
-
{
|
|
626
|
-
return a ^ b * c;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
function bitXorDiv(uint256 a, uint256 b, uint256 c)
|
|
630
|
-
public
|
|
631
|
-
pure
|
|
632
|
-
returns (uint256)
|
|
633
|
-
{
|
|
634
|
-
return a ^ b / c;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function bitXorMod(uint256 a, uint256 b, uint256 c)
|
|
638
|
-
public
|
|
639
|
-
pure
|
|
640
|
-
returns (uint256)
|
|
641
|
-
{
|
|
642
|
-
return a ^ b % c;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
function bitXorExp(uint256 a, uint256 b, uint256 c)
|
|
646
|
-
public
|
|
647
|
-
pure
|
|
648
|
-
returns (uint256)
|
|
649
|
-
{
|
|
650
|
-
return a ^ b ** c;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
function bitXorShiftL(uint256 a, uint256 b, uint256 c)
|
|
654
|
-
public
|
|
655
|
-
pure
|
|
656
|
-
returns (uint256)
|
|
657
|
-
{
|
|
658
|
-
return a ^ b << c;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
function bitXorShiftR(uint256 a, uint256 b, uint256 c)
|
|
662
|
-
public
|
|
663
|
-
pure
|
|
664
|
-
returns (uint256)
|
|
665
|
-
{
|
|
666
|
-
return a ^ b >> c;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
function bitXorBitAnd(uint256 a, uint256 b, uint256 c)
|
|
670
|
-
public
|
|
671
|
-
pure
|
|
672
|
-
returns (uint256)
|
|
673
|
-
{
|
|
674
|
-
return a ^ b & c;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
function bitXorBitOr(uint256 a, uint256 b, uint256 c)
|
|
678
|
-
public
|
|
679
|
-
pure
|
|
680
|
-
returns (uint256)
|
|
681
|
-
{
|
|
682
|
-
return a ^ b | c;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function bitXorBitXor(uint256 a, uint256 b, uint256 c)
|
|
686
|
-
public
|
|
687
|
-
pure
|
|
688
|
-
returns (uint256)
|
|
689
|
-
{
|
|
690
|
-
return a ^ b ^ c;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
=====================================output=====================================
|
|
695
|
-
// SPDX-License-Identifier: MIT
|
|
696
|
-
pragma solidity 0.8.10;
|
|
697
|
-
|
|
698
|
-
contract BitXorNoParentheses {
|
|
699
|
-
function bitXorAdd(
|
|
700
|
-
uint256 a,
|
|
701
|
-
uint256 b,
|
|
702
|
-
uint256 c
|
|
703
|
-
) public pure returns (uint256) {
|
|
704
|
-
return a ^ (b + c);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function bitXorSub(
|
|
708
|
-
uint256 a,
|
|
709
|
-
uint256 b,
|
|
710
|
-
uint256 c
|
|
711
|
-
) public pure returns (uint256) {
|
|
712
|
-
return a ^ (b - c);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
function bitXorMul(
|
|
716
|
-
uint256 a,
|
|
717
|
-
uint256 b,
|
|
718
|
-
uint256 c
|
|
719
|
-
) public pure returns (uint256) {
|
|
720
|
-
return a ^ (b * c);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
function bitXorDiv(
|
|
724
|
-
uint256 a,
|
|
725
|
-
uint256 b,
|
|
726
|
-
uint256 c
|
|
727
|
-
) public pure returns (uint256) {
|
|
728
|
-
return a ^ (b / c);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
function bitXorMod(
|
|
732
|
-
uint256 a,
|
|
733
|
-
uint256 b,
|
|
734
|
-
uint256 c
|
|
735
|
-
) public pure returns (uint256) {
|
|
736
|
-
return a ^ b % c;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function bitXorExp(
|
|
740
|
-
uint256 a,
|
|
741
|
-
uint256 b,
|
|
742
|
-
uint256 c
|
|
743
|
-
) public pure returns (uint256) {
|
|
744
|
-
return a ^ (b**c);
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
function bitXorShiftL(
|
|
748
|
-
uint256 a,
|
|
749
|
-
uint256 b,
|
|
750
|
-
uint256 c
|
|
751
|
-
) public pure returns (uint256) {
|
|
752
|
-
return a ^ (b << c);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
function bitXorShiftR(
|
|
756
|
-
uint256 a,
|
|
757
|
-
uint256 b,
|
|
758
|
-
uint256 c
|
|
759
|
-
) public pure returns (uint256) {
|
|
760
|
-
return a ^ (b >> c);
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
function bitXorBitAnd(
|
|
764
|
-
uint256 a,
|
|
765
|
-
uint256 b,
|
|
766
|
-
uint256 c
|
|
767
|
-
) public pure returns (uint256) {
|
|
768
|
-
return a ^ (b & c);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
function bitXorBitOr(
|
|
772
|
-
uint256 a,
|
|
773
|
-
uint256 b,
|
|
774
|
-
uint256 c
|
|
775
|
-
) public pure returns (uint256) {
|
|
776
|
-
return (a ^ b) | c;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
function bitXorBitXor(
|
|
780
|
-
uint256 a,
|
|
781
|
-
uint256 b,
|
|
782
|
-
uint256 c
|
|
783
|
-
) public pure returns (uint256) {
|
|
784
|
-
return a ^ b ^ c;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
================================================================================
|
|
789
|
-
`;
|
|
790
|
-
|
|
791
|
-
exports[`DivNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
792
|
-
====================================options=====================================
|
|
793
|
-
compiler: "0.8.6"
|
|
794
|
-
parsers: ["solidity-parse"]
|
|
795
|
-
printWidth: 80
|
|
796
|
-
| printWidth
|
|
797
|
-
=====================================input======================================
|
|
798
|
-
// SPDX-License-Identifier: MIT
|
|
799
|
-
pragma solidity 0.8.10;
|
|
800
|
-
|
|
801
|
-
contract DivNoParentheses {
|
|
802
|
-
function divAdd(uint256 a, uint256 b, uint256 c)
|
|
803
|
-
public
|
|
804
|
-
pure
|
|
805
|
-
returns (uint256)
|
|
806
|
-
{
|
|
807
|
-
return a / b + c;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function divSub(uint256 a, uint256 b, uint256 c)
|
|
811
|
-
public
|
|
812
|
-
pure
|
|
813
|
-
returns (uint256)
|
|
814
|
-
{
|
|
815
|
-
return a / b - c;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
function divMul(uint256 a, uint256 b, uint256 c)
|
|
819
|
-
public
|
|
820
|
-
pure
|
|
821
|
-
returns (uint256)
|
|
822
|
-
{
|
|
823
|
-
return a / b * c;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
function divDiv(uint256 a, uint256 b, uint256 c)
|
|
827
|
-
public
|
|
828
|
-
pure
|
|
829
|
-
returns (uint256)
|
|
830
|
-
{
|
|
831
|
-
return a / b / c;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
function divMod(uint256 a, uint256 b, uint256 c)
|
|
835
|
-
public
|
|
836
|
-
pure
|
|
837
|
-
returns (uint256)
|
|
838
|
-
{
|
|
839
|
-
return a / b % c;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function divExp(uint256 a, uint256 b, uint256 c)
|
|
843
|
-
public
|
|
844
|
-
pure
|
|
845
|
-
returns (uint256)
|
|
846
|
-
{
|
|
847
|
-
return a / b ** c;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
function divShiftL(uint256 a, uint256 b, uint256 c)
|
|
851
|
-
public
|
|
852
|
-
pure
|
|
853
|
-
returns (uint256)
|
|
854
|
-
{
|
|
855
|
-
return a / b << c;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
function divShiftR(uint256 a, uint256 b, uint256 c)
|
|
859
|
-
public
|
|
860
|
-
pure
|
|
861
|
-
returns (uint256)
|
|
862
|
-
{
|
|
863
|
-
return a / b >> c;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
function divBitAnd(uint256 a, uint256 b, uint256 c)
|
|
867
|
-
public
|
|
868
|
-
pure
|
|
869
|
-
returns (uint256)
|
|
870
|
-
{
|
|
871
|
-
return a / b & c;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
function divBitOr(uint256 a, uint256 b, uint256 c)
|
|
875
|
-
public
|
|
876
|
-
pure
|
|
877
|
-
returns (uint256)
|
|
878
|
-
{
|
|
879
|
-
return a / b | c;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
function divBitXor(uint256 a, uint256 b, uint256 c)
|
|
883
|
-
public
|
|
884
|
-
pure
|
|
885
|
-
returns (uint256)
|
|
886
|
-
{
|
|
887
|
-
return a / b ^ c;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
=====================================output=====================================
|
|
892
|
-
// SPDX-License-Identifier: MIT
|
|
893
|
-
pragma solidity 0.8.10;
|
|
894
|
-
|
|
895
|
-
contract DivNoParentheses {
|
|
896
|
-
function divAdd(
|
|
897
|
-
uint256 a,
|
|
898
|
-
uint256 b,
|
|
899
|
-
uint256 c
|
|
900
|
-
) public pure returns (uint256) {
|
|
901
|
-
return a / b + c;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
function divSub(
|
|
905
|
-
uint256 a,
|
|
906
|
-
uint256 b,
|
|
907
|
-
uint256 c
|
|
908
|
-
) public pure returns (uint256) {
|
|
909
|
-
return a / b - c;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
function divMul(
|
|
913
|
-
uint256 a,
|
|
914
|
-
uint256 b,
|
|
915
|
-
uint256 c
|
|
916
|
-
) public pure returns (uint256) {
|
|
917
|
-
return (a / b) * c;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
function divDiv(
|
|
921
|
-
uint256 a,
|
|
922
|
-
uint256 b,
|
|
923
|
-
uint256 c
|
|
924
|
-
) public pure returns (uint256) {
|
|
925
|
-
return a / b / c;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
function divMod(
|
|
929
|
-
uint256 a,
|
|
930
|
-
uint256 b,
|
|
931
|
-
uint256 c
|
|
932
|
-
) public pure returns (uint256) {
|
|
933
|
-
return (a / b) % c;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
function divExp(
|
|
937
|
-
uint256 a,
|
|
938
|
-
uint256 b,
|
|
939
|
-
uint256 c
|
|
940
|
-
) public pure returns (uint256) {
|
|
941
|
-
return a / b**c;
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
function divShiftL(
|
|
945
|
-
uint256 a,
|
|
946
|
-
uint256 b,
|
|
947
|
-
uint256 c
|
|
948
|
-
) public pure returns (uint256) {
|
|
949
|
-
return (a / b) << c;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
function divShiftR(
|
|
953
|
-
uint256 a,
|
|
954
|
-
uint256 b,
|
|
955
|
-
uint256 c
|
|
956
|
-
) public pure returns (uint256) {
|
|
957
|
-
return (a / b) >> c;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
function divBitAnd(
|
|
961
|
-
uint256 a,
|
|
962
|
-
uint256 b,
|
|
963
|
-
uint256 c
|
|
964
|
-
) public pure returns (uint256) {
|
|
965
|
-
return (a / b) & c;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
function divBitOr(
|
|
969
|
-
uint256 a,
|
|
970
|
-
uint256 b,
|
|
971
|
-
uint256 c
|
|
972
|
-
) public pure returns (uint256) {
|
|
973
|
-
return (a / b) | c;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
function divBitXor(
|
|
977
|
-
uint256 a,
|
|
978
|
-
uint256 b,
|
|
979
|
-
uint256 c
|
|
980
|
-
) public pure returns (uint256) {
|
|
981
|
-
return (a / b) ^ c;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
================================================================================
|
|
986
|
-
`;
|
|
987
|
-
|
|
988
|
-
exports[`ExpNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
989
|
-
====================================options=====================================
|
|
990
|
-
compiler: "0.8.6"
|
|
991
|
-
parsers: ["solidity-parse"]
|
|
992
|
-
printWidth: 80
|
|
993
|
-
| printWidth
|
|
994
|
-
=====================================input======================================
|
|
995
|
-
// SPDX-License-Identifier: MIT
|
|
996
|
-
pragma solidity 0.8.10;
|
|
997
|
-
|
|
998
|
-
contract ExpNoParentheses {
|
|
999
|
-
function expAdd(uint256 a, uint256 b, uint256 c)
|
|
1000
|
-
public
|
|
1001
|
-
pure
|
|
1002
|
-
returns (uint256)
|
|
1003
|
-
{
|
|
1004
|
-
return a ** b + c;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
function expSub(uint256 a, uint256 b, uint256 c)
|
|
1008
|
-
public
|
|
1009
|
-
pure
|
|
1010
|
-
returns (uint256)
|
|
1011
|
-
{
|
|
1012
|
-
return a ** b - c;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
function expMul(uint256 a, uint256 b, uint256 c)
|
|
1016
|
-
public
|
|
1017
|
-
pure
|
|
1018
|
-
returns (uint256)
|
|
1019
|
-
{
|
|
1020
|
-
return a ** b * c;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
function expDiv(uint256 a, uint256 b, uint256 c)
|
|
1024
|
-
public
|
|
1025
|
-
pure
|
|
1026
|
-
returns (uint256)
|
|
1027
|
-
{
|
|
1028
|
-
return a ** b / c;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
function expMod(uint256 a, uint256 b, uint256 c)
|
|
1032
|
-
public
|
|
1033
|
-
pure
|
|
1034
|
-
returns (uint256)
|
|
1035
|
-
{
|
|
1036
|
-
return a ** b % c;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
function expExp(uint256 a, uint256 b, uint256 c)
|
|
1040
|
-
public
|
|
1041
|
-
pure
|
|
1042
|
-
returns (uint256)
|
|
1043
|
-
{
|
|
1044
|
-
return a ** b ** c;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
function expShiftL(uint256 a, uint256 b, uint256 c)
|
|
1048
|
-
public
|
|
1049
|
-
pure
|
|
1050
|
-
returns (uint256)
|
|
1051
|
-
{
|
|
1052
|
-
return a ** b << c;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
function expShiftR(uint256 a, uint256 b, uint256 c)
|
|
1056
|
-
public
|
|
1057
|
-
pure
|
|
1058
|
-
returns (uint256)
|
|
1059
|
-
{
|
|
1060
|
-
return a ** b >> c;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
function expBitAnd(uint256 a, uint256 b, uint256 c)
|
|
1064
|
-
public
|
|
1065
|
-
pure
|
|
1066
|
-
returns (uint256)
|
|
1067
|
-
{
|
|
1068
|
-
return a ** b & c;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
function expBitOr(uint256 a, uint256 b, uint256 c)
|
|
1072
|
-
public
|
|
1073
|
-
pure
|
|
1074
|
-
returns (uint256)
|
|
1075
|
-
{
|
|
1076
|
-
return a ** b | c;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
function expBitXor(uint256 a, uint256 b, uint256 c)
|
|
1080
|
-
public
|
|
1081
|
-
pure
|
|
1082
|
-
returns (uint256)
|
|
1083
|
-
{
|
|
1084
|
-
return a ** b ^ c;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
=====================================output=====================================
|
|
1089
|
-
// SPDX-License-Identifier: MIT
|
|
1090
|
-
pragma solidity 0.8.10;
|
|
1091
|
-
|
|
1092
|
-
contract ExpNoParentheses {
|
|
1093
|
-
function expAdd(
|
|
1094
|
-
uint256 a,
|
|
1095
|
-
uint256 b,
|
|
1096
|
-
uint256 c
|
|
1097
|
-
) public pure returns (uint256) {
|
|
1098
|
-
return a**b + c;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function expSub(
|
|
1102
|
-
uint256 a,
|
|
1103
|
-
uint256 b,
|
|
1104
|
-
uint256 c
|
|
1105
|
-
) public pure returns (uint256) {
|
|
1106
|
-
return a**b - c;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
function expMul(
|
|
1110
|
-
uint256 a,
|
|
1111
|
-
uint256 b,
|
|
1112
|
-
uint256 c
|
|
1113
|
-
) public pure returns (uint256) {
|
|
1114
|
-
return a**b * c;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
function expDiv(
|
|
1118
|
-
uint256 a,
|
|
1119
|
-
uint256 b,
|
|
1120
|
-
uint256 c
|
|
1121
|
-
) public pure returns (uint256) {
|
|
1122
|
-
return a**b / c;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
function expMod(
|
|
1126
|
-
uint256 a,
|
|
1127
|
-
uint256 b,
|
|
1128
|
-
uint256 c
|
|
1129
|
-
) public pure returns (uint256) {
|
|
1130
|
-
return a**b % c;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
function expExp(
|
|
1134
|
-
uint256 a,
|
|
1135
|
-
uint256 b,
|
|
1136
|
-
uint256 c
|
|
1137
|
-
) public pure returns (uint256) {
|
|
1138
|
-
return a**(b**c);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
function expShiftL(
|
|
1142
|
-
uint256 a,
|
|
1143
|
-
uint256 b,
|
|
1144
|
-
uint256 c
|
|
1145
|
-
) public pure returns (uint256) {
|
|
1146
|
-
return (a**b) << c;
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
function expShiftR(
|
|
1150
|
-
uint256 a,
|
|
1151
|
-
uint256 b,
|
|
1152
|
-
uint256 c
|
|
1153
|
-
) public pure returns (uint256) {
|
|
1154
|
-
return (a**b) >> c;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
function expBitAnd(
|
|
1158
|
-
uint256 a,
|
|
1159
|
-
uint256 b,
|
|
1160
|
-
uint256 c
|
|
1161
|
-
) public pure returns (uint256) {
|
|
1162
|
-
return (a**b) & c;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function expBitOr(
|
|
1166
|
-
uint256 a,
|
|
1167
|
-
uint256 b,
|
|
1168
|
-
uint256 c
|
|
1169
|
-
) public pure returns (uint256) {
|
|
1170
|
-
return (a**b) | c;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
function expBitXor(
|
|
1174
|
-
uint256 a,
|
|
1175
|
-
uint256 b,
|
|
1176
|
-
uint256 c
|
|
1177
|
-
) public pure returns (uint256) {
|
|
1178
|
-
return (a**b) ^ c;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
================================================================================
|
|
1183
|
-
`;
|
|
1184
|
-
|
|
1185
|
-
exports[`LogicNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
1186
|
-
====================================options=====================================
|
|
1187
|
-
compiler: "0.8.6"
|
|
1188
|
-
parsers: ["solidity-parse"]
|
|
1189
|
-
printWidth: 80
|
|
1190
|
-
| printWidth
|
|
1191
|
-
=====================================input======================================
|
|
1192
|
-
// SPDX-License-Identifier: MIT
|
|
1193
|
-
pragma solidity 0.8.10;
|
|
1194
|
-
|
|
1195
|
-
contract LogicNoParentheses {
|
|
1196
|
-
function orOr(bool a, bool b, bool c) public pure returns (bool) {
|
|
1197
|
-
return a || b || c;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
function orAnd(bool a, bool b, bool c) public pure returns (bool) {
|
|
1201
|
-
return a || b && c;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
function andOr(bool a, bool b, bool c) public pure returns (bool) {
|
|
1205
|
-
return a && b || c;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
function andAnd(bool a, bool b, bool c) public pure returns (bool) {
|
|
1209
|
-
return a && b && c;
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
=====================================output=====================================
|
|
1214
|
-
// SPDX-License-Identifier: MIT
|
|
1215
|
-
pragma solidity 0.8.10;
|
|
1216
|
-
|
|
1217
|
-
contract LogicNoParentheses {
|
|
1218
|
-
function orOr(
|
|
1219
|
-
bool a,
|
|
1220
|
-
bool b,
|
|
1221
|
-
bool c
|
|
1222
|
-
) public pure returns (bool) {
|
|
1223
|
-
return a || b || c;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
function orAnd(
|
|
1227
|
-
bool a,
|
|
1228
|
-
bool b,
|
|
1229
|
-
bool c
|
|
1230
|
-
) public pure returns (bool) {
|
|
1231
|
-
return a || (b && c);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
function andOr(
|
|
1235
|
-
bool a,
|
|
1236
|
-
bool b,
|
|
1237
|
-
bool c
|
|
1238
|
-
) public pure returns (bool) {
|
|
1239
|
-
return (a && b) || c;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
function andAnd(
|
|
1243
|
-
bool a,
|
|
1244
|
-
bool b,
|
|
1245
|
-
bool c
|
|
1246
|
-
) public pure returns (bool) {
|
|
1247
|
-
return a && b && c;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
================================================================================
|
|
1252
|
-
`;
|
|
1253
|
-
|
|
1254
|
-
exports[`ModNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
1255
|
-
====================================options=====================================
|
|
1256
|
-
compiler: "0.8.6"
|
|
1257
|
-
parsers: ["solidity-parse"]
|
|
1258
|
-
printWidth: 80
|
|
1259
|
-
| printWidth
|
|
1260
|
-
=====================================input======================================
|
|
1261
|
-
// SPDX-License-Identifier: MIT
|
|
1262
|
-
pragma solidity 0.8.10;
|
|
1263
|
-
|
|
1264
|
-
contract ModNoParentheses {
|
|
1265
|
-
function modAdd(uint256 a, uint256 b, uint256 c)
|
|
1266
|
-
public
|
|
1267
|
-
pure
|
|
1268
|
-
returns (uint256)
|
|
1269
|
-
{
|
|
1270
|
-
return a % b + c;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
function modSub(uint256 a, uint256 b, uint256 c)
|
|
1274
|
-
public
|
|
1275
|
-
pure
|
|
1276
|
-
returns (uint256)
|
|
1277
|
-
{
|
|
1278
|
-
return a % b - c;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
function modMul(uint256 a, uint256 b, uint256 c)
|
|
1282
|
-
public
|
|
1283
|
-
pure
|
|
1284
|
-
returns (uint256)
|
|
1285
|
-
{
|
|
1286
|
-
return a % b * c;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
function modDiv(uint256 a, uint256 b, uint256 c)
|
|
1290
|
-
public
|
|
1291
|
-
pure
|
|
1292
|
-
returns (uint256)
|
|
1293
|
-
{
|
|
1294
|
-
return a % b / c;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
function modMod(uint256 a, uint256 b, uint256 c)
|
|
1298
|
-
public
|
|
1299
|
-
pure
|
|
1300
|
-
returns (uint256)
|
|
1301
|
-
{
|
|
1302
|
-
return a % b % c;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
function modExp(uint256 a, uint256 b, uint256 c)
|
|
1306
|
-
public
|
|
1307
|
-
pure
|
|
1308
|
-
returns (uint256)
|
|
1309
|
-
{
|
|
1310
|
-
return a % b ** c;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
function modShiftL(uint256 a, uint256 b, uint256 c)
|
|
1314
|
-
public
|
|
1315
|
-
pure
|
|
1316
|
-
returns (uint256)
|
|
1317
|
-
{
|
|
1318
|
-
return a % b << c;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
function modShiftR(uint256 a, uint256 b, uint256 c)
|
|
1322
|
-
public
|
|
1323
|
-
pure
|
|
1324
|
-
returns (uint256)
|
|
1325
|
-
{
|
|
1326
|
-
return a % b >> c;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
function modBitAnd(uint256 a, uint256 b, uint256 c)
|
|
1330
|
-
public
|
|
1331
|
-
pure
|
|
1332
|
-
returns (uint256)
|
|
1333
|
-
{
|
|
1334
|
-
return a % b & c;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
function modBitOr(uint256 a, uint256 b, uint256 c)
|
|
1338
|
-
public
|
|
1339
|
-
pure
|
|
1340
|
-
returns (uint256)
|
|
1341
|
-
{
|
|
1342
|
-
return a % b | c;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
function modBitXor(uint256 a, uint256 b, uint256 c)
|
|
1346
|
-
public
|
|
1347
|
-
pure
|
|
1348
|
-
returns (uint256)
|
|
1349
|
-
{
|
|
1350
|
-
return a % b ^ c;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
=====================================output=====================================
|
|
1355
|
-
// SPDX-License-Identifier: MIT
|
|
1356
|
-
pragma solidity 0.8.10;
|
|
1357
|
-
|
|
1358
|
-
contract ModNoParentheses {
|
|
1359
|
-
function modAdd(
|
|
1360
|
-
uint256 a,
|
|
1361
|
-
uint256 b,
|
|
1362
|
-
uint256 c
|
|
1363
|
-
) public pure returns (uint256) {
|
|
1364
|
-
return (a % b) + c;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
function modSub(
|
|
1368
|
-
uint256 a,
|
|
1369
|
-
uint256 b,
|
|
1370
|
-
uint256 c
|
|
1371
|
-
) public pure returns (uint256) {
|
|
1372
|
-
return (a % b) - c;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
function modMul(
|
|
1376
|
-
uint256 a,
|
|
1377
|
-
uint256 b,
|
|
1378
|
-
uint256 c
|
|
1379
|
-
) public pure returns (uint256) {
|
|
1380
|
-
return (a % b) * c;
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
function modDiv(
|
|
1384
|
-
uint256 a,
|
|
1385
|
-
uint256 b,
|
|
1386
|
-
uint256 c
|
|
1387
|
-
) public pure returns (uint256) {
|
|
1388
|
-
return (a % b) / c;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
function modMod(
|
|
1392
|
-
uint256 a,
|
|
1393
|
-
uint256 b,
|
|
1394
|
-
uint256 c
|
|
1395
|
-
) public pure returns (uint256) {
|
|
1396
|
-
return (a % b) % c;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
function modExp(
|
|
1400
|
-
uint256 a,
|
|
1401
|
-
uint256 b,
|
|
1402
|
-
uint256 c
|
|
1403
|
-
) public pure returns (uint256) {
|
|
1404
|
-
return a % b**c;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
function modShiftL(
|
|
1408
|
-
uint256 a,
|
|
1409
|
-
uint256 b,
|
|
1410
|
-
uint256 c
|
|
1411
|
-
) public pure returns (uint256) {
|
|
1412
|
-
return a % b << c;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
function modShiftR(
|
|
1416
|
-
uint256 a,
|
|
1417
|
-
uint256 b,
|
|
1418
|
-
uint256 c
|
|
1419
|
-
) public pure returns (uint256) {
|
|
1420
|
-
return a % b >> c;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
function modBitAnd(
|
|
1424
|
-
uint256 a,
|
|
1425
|
-
uint256 b,
|
|
1426
|
-
uint256 c
|
|
1427
|
-
) public pure returns (uint256) {
|
|
1428
|
-
return a % b & c;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
function modBitOr(
|
|
1432
|
-
uint256 a,
|
|
1433
|
-
uint256 b,
|
|
1434
|
-
uint256 c
|
|
1435
|
-
) public pure returns (uint256) {
|
|
1436
|
-
return a % b | c;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
function modBitXor(
|
|
1440
|
-
uint256 a,
|
|
1441
|
-
uint256 b,
|
|
1442
|
-
uint256 c
|
|
1443
|
-
) public pure returns (uint256) {
|
|
1444
|
-
return a % b ^ c;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
================================================================================
|
|
1449
|
-
`;
|
|
1450
|
-
|
|
1451
|
-
exports[`MulNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
1452
|
-
====================================options=====================================
|
|
1453
|
-
compiler: "0.8.6"
|
|
1454
|
-
parsers: ["solidity-parse"]
|
|
1455
|
-
printWidth: 80
|
|
1456
|
-
| printWidth
|
|
1457
|
-
=====================================input======================================
|
|
1458
|
-
// SPDX-License-Identifier: MIT
|
|
1459
|
-
pragma solidity 0.8.10;
|
|
1460
|
-
|
|
1461
|
-
contract MulNoParentheses {
|
|
1462
|
-
function mulAdd(uint256 a, uint256 b, uint256 c)
|
|
1463
|
-
public
|
|
1464
|
-
pure
|
|
1465
|
-
returns (uint256)
|
|
1466
|
-
{
|
|
1467
|
-
return a * b + c;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
function mulSub(uint256 a, uint256 b, uint256 c)
|
|
1471
|
-
public
|
|
1472
|
-
pure
|
|
1473
|
-
returns (uint256)
|
|
1474
|
-
{
|
|
1475
|
-
return a * b - c;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
function mulMul(uint256 a, uint256 b, uint256 c)
|
|
1479
|
-
public
|
|
1480
|
-
pure
|
|
1481
|
-
returns (uint256)
|
|
1482
|
-
{
|
|
1483
|
-
return a * b * c;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
function mulDiv(uint256 a, uint256 b, uint256 c)
|
|
1487
|
-
public
|
|
1488
|
-
pure
|
|
1489
|
-
returns (uint256)
|
|
1490
|
-
{
|
|
1491
|
-
return a * b / c;
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
function mulMod(uint256 a, uint256 b, uint256 c)
|
|
1495
|
-
public
|
|
1496
|
-
pure
|
|
1497
|
-
returns (uint256)
|
|
1498
|
-
{
|
|
1499
|
-
return a * b % c;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
function mulExp(uint256 a, uint256 b, uint256 c)
|
|
1503
|
-
public
|
|
1504
|
-
pure
|
|
1505
|
-
returns (uint256)
|
|
1506
|
-
{
|
|
1507
|
-
return a * b ** c;
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
function mulShiftL(uint256 a, uint256 b, uint256 c)
|
|
1511
|
-
public
|
|
1512
|
-
pure
|
|
1513
|
-
returns (uint256)
|
|
1514
|
-
{
|
|
1515
|
-
return a * b << c;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
function mulShiftR(uint256 a, uint256 b, uint256 c)
|
|
1519
|
-
public
|
|
1520
|
-
pure
|
|
1521
|
-
returns (uint256)
|
|
1522
|
-
{
|
|
1523
|
-
return a * b >> c;
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
function mulBitAnd(uint256 a, uint256 b, uint256 c)
|
|
1527
|
-
public
|
|
1528
|
-
pure
|
|
1529
|
-
returns (uint256)
|
|
1530
|
-
{
|
|
1531
|
-
return a * b & c;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
function mulBitOr(uint256 a, uint256 b, uint256 c)
|
|
1535
|
-
public
|
|
1536
|
-
pure
|
|
1537
|
-
returns (uint256)
|
|
1538
|
-
{
|
|
1539
|
-
return a * b | c;
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
function mulBitXor(uint256 a, uint256 b, uint256 c)
|
|
1543
|
-
public
|
|
1544
|
-
pure
|
|
1545
|
-
returns (uint256)
|
|
1546
|
-
{
|
|
1547
|
-
return a * b ^ c;
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
=====================================output=====================================
|
|
1552
|
-
// SPDX-License-Identifier: MIT
|
|
1553
|
-
pragma solidity 0.8.10;
|
|
1554
|
-
|
|
1555
|
-
contract MulNoParentheses {
|
|
1556
|
-
function mulAdd(
|
|
1557
|
-
uint256 a,
|
|
1558
|
-
uint256 b,
|
|
1559
|
-
uint256 c
|
|
1560
|
-
) public pure returns (uint256) {
|
|
1561
|
-
return a * b + c;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
function mulSub(
|
|
1565
|
-
uint256 a,
|
|
1566
|
-
uint256 b,
|
|
1567
|
-
uint256 c
|
|
1568
|
-
) public pure returns (uint256) {
|
|
1569
|
-
return a * b - c;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
function mulMul(
|
|
1573
|
-
uint256 a,
|
|
1574
|
-
uint256 b,
|
|
1575
|
-
uint256 c
|
|
1576
|
-
) public pure returns (uint256) {
|
|
1577
|
-
return a * b * c;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
function mulDiv(
|
|
1581
|
-
uint256 a,
|
|
1582
|
-
uint256 b,
|
|
1583
|
-
uint256 c
|
|
1584
|
-
) public pure returns (uint256) {
|
|
1585
|
-
return (a * b) / c;
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
function mulMod(
|
|
1589
|
-
uint256 a,
|
|
1590
|
-
uint256 b,
|
|
1591
|
-
uint256 c
|
|
1592
|
-
) public pure returns (uint256) {
|
|
1593
|
-
return (a * b) % c;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
function mulExp(
|
|
1597
|
-
uint256 a,
|
|
1598
|
-
uint256 b,
|
|
1599
|
-
uint256 c
|
|
1600
|
-
) public pure returns (uint256) {
|
|
1601
|
-
return a * b**c;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
function mulShiftL(
|
|
1605
|
-
uint256 a,
|
|
1606
|
-
uint256 b,
|
|
1607
|
-
uint256 c
|
|
1608
|
-
) public pure returns (uint256) {
|
|
1609
|
-
return (a * b) << c;
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
function mulShiftR(
|
|
1613
|
-
uint256 a,
|
|
1614
|
-
uint256 b,
|
|
1615
|
-
uint256 c
|
|
1616
|
-
) public pure returns (uint256) {
|
|
1617
|
-
return (a * b) >> c;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
function mulBitAnd(
|
|
1621
|
-
uint256 a,
|
|
1622
|
-
uint256 b,
|
|
1623
|
-
uint256 c
|
|
1624
|
-
) public pure returns (uint256) {
|
|
1625
|
-
return (a * b) & c;
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
function mulBitOr(
|
|
1629
|
-
uint256 a,
|
|
1630
|
-
uint256 b,
|
|
1631
|
-
uint256 c
|
|
1632
|
-
) public pure returns (uint256) {
|
|
1633
|
-
return (a * b) | c;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
function mulBitXor(
|
|
1637
|
-
uint256 a,
|
|
1638
|
-
uint256 b,
|
|
1639
|
-
uint256 c
|
|
1640
|
-
) public pure returns (uint256) {
|
|
1641
|
-
return (a * b) ^ c;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
================================================================================
|
|
1646
|
-
`;
|
|
1647
|
-
|
|
1648
|
-
exports[`ShiftLNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
1649
|
-
====================================options=====================================
|
|
1650
|
-
compiler: "0.8.6"
|
|
1651
|
-
parsers: ["solidity-parse"]
|
|
1652
|
-
printWidth: 80
|
|
1653
|
-
| printWidth
|
|
1654
|
-
=====================================input======================================
|
|
1655
|
-
// SPDX-License-Identifier: MIT
|
|
1656
|
-
pragma solidity 0.8.10;
|
|
1657
|
-
|
|
1658
|
-
contract ShiftLNoParentheses {
|
|
1659
|
-
function shiftLAdd(uint256 a, uint256 b, uint256 c)
|
|
1660
|
-
public
|
|
1661
|
-
pure
|
|
1662
|
-
returns (uint256)
|
|
1663
|
-
{
|
|
1664
|
-
return a << b + c;
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
function shiftLSub(uint256 a, uint256 b, uint256 c)
|
|
1668
|
-
public
|
|
1669
|
-
pure
|
|
1670
|
-
returns (uint256)
|
|
1671
|
-
{
|
|
1672
|
-
return a << b - c;
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
function shiftLMul(uint256 a, uint256 b, uint256 c)
|
|
1676
|
-
public
|
|
1677
|
-
pure
|
|
1678
|
-
returns (uint256)
|
|
1679
|
-
{
|
|
1680
|
-
return a << b * c;
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
function shiftLDiv(uint256 a, uint256 b, uint256 c)
|
|
1684
|
-
public
|
|
1685
|
-
pure
|
|
1686
|
-
returns (uint256)
|
|
1687
|
-
{
|
|
1688
|
-
return a << b / c;
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
function shiftLMod(uint256 a, uint256 b, uint256 c)
|
|
1692
|
-
public
|
|
1693
|
-
pure
|
|
1694
|
-
returns (uint256)
|
|
1695
|
-
{
|
|
1696
|
-
return a << b % c;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
function shiftLExp(uint256 a, uint256 b, uint256 c)
|
|
1700
|
-
public
|
|
1701
|
-
pure
|
|
1702
|
-
returns (uint256)
|
|
1703
|
-
{
|
|
1704
|
-
return a << b ** c;
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
function shiftLShiftL(uint256 a, uint256 b, uint256 c)
|
|
1708
|
-
public
|
|
1709
|
-
pure
|
|
1710
|
-
returns (uint256)
|
|
1711
|
-
{
|
|
1712
|
-
return a << b << c;
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
function shiftLShiftR(uint256 a, uint256 b, uint256 c)
|
|
1716
|
-
public
|
|
1717
|
-
pure
|
|
1718
|
-
returns (uint256)
|
|
1719
|
-
{
|
|
1720
|
-
return a << b >> c;
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
function shiftLBitAnd(uint256 a, uint256 b, uint256 c)
|
|
1724
|
-
public
|
|
1725
|
-
pure
|
|
1726
|
-
returns (uint256)
|
|
1727
|
-
{
|
|
1728
|
-
return a << b & c;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
function shiftLBitOr(uint256 a, uint256 b, uint256 c)
|
|
1732
|
-
public
|
|
1733
|
-
pure
|
|
1734
|
-
returns (uint256)
|
|
1735
|
-
{
|
|
1736
|
-
return a << b | c;
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
function shiftLBitXor(uint256 a, uint256 b, uint256 c)
|
|
1740
|
-
public
|
|
1741
|
-
pure
|
|
1742
|
-
returns (uint256)
|
|
1743
|
-
{
|
|
1744
|
-
return a << b ^ c;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
=====================================output=====================================
|
|
1749
|
-
// SPDX-License-Identifier: MIT
|
|
1750
|
-
pragma solidity 0.8.10;
|
|
1751
|
-
|
|
1752
|
-
contract ShiftLNoParentheses {
|
|
1753
|
-
function shiftLAdd(
|
|
1754
|
-
uint256 a,
|
|
1755
|
-
uint256 b,
|
|
1756
|
-
uint256 c
|
|
1757
|
-
) public pure returns (uint256) {
|
|
1758
|
-
return a << (b + c);
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
function shiftLSub(
|
|
1762
|
-
uint256 a,
|
|
1763
|
-
uint256 b,
|
|
1764
|
-
uint256 c
|
|
1765
|
-
) public pure returns (uint256) {
|
|
1766
|
-
return a << (b - c);
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
function shiftLMul(
|
|
1770
|
-
uint256 a,
|
|
1771
|
-
uint256 b,
|
|
1772
|
-
uint256 c
|
|
1773
|
-
) public pure returns (uint256) {
|
|
1774
|
-
return a << (b * c);
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
function shiftLDiv(
|
|
1778
|
-
uint256 a,
|
|
1779
|
-
uint256 b,
|
|
1780
|
-
uint256 c
|
|
1781
|
-
) public pure returns (uint256) {
|
|
1782
|
-
return a << (b / c);
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
function shiftLMod(
|
|
1786
|
-
uint256 a,
|
|
1787
|
-
uint256 b,
|
|
1788
|
-
uint256 c
|
|
1789
|
-
) public pure returns (uint256) {
|
|
1790
|
-
return a << b % c;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
function shiftLExp(
|
|
1794
|
-
uint256 a,
|
|
1795
|
-
uint256 b,
|
|
1796
|
-
uint256 c
|
|
1797
|
-
) public pure returns (uint256) {
|
|
1798
|
-
return a << (b**c);
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
function shiftLShiftL(
|
|
1802
|
-
uint256 a,
|
|
1803
|
-
uint256 b,
|
|
1804
|
-
uint256 c
|
|
1805
|
-
) public pure returns (uint256) {
|
|
1806
|
-
return (a << b) << c;
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
function shiftLShiftR(
|
|
1810
|
-
uint256 a,
|
|
1811
|
-
uint256 b,
|
|
1812
|
-
uint256 c
|
|
1813
|
-
) public pure returns (uint256) {
|
|
1814
|
-
return (a << b) >> c;
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
function shiftLBitAnd(
|
|
1818
|
-
uint256 a,
|
|
1819
|
-
uint256 b,
|
|
1820
|
-
uint256 c
|
|
1821
|
-
) public pure returns (uint256) {
|
|
1822
|
-
return (a << b) & c;
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
function shiftLBitOr(
|
|
1826
|
-
uint256 a,
|
|
1827
|
-
uint256 b,
|
|
1828
|
-
uint256 c
|
|
1829
|
-
) public pure returns (uint256) {
|
|
1830
|
-
return (a << b) | c;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
function shiftLBitXor(
|
|
1834
|
-
uint256 a,
|
|
1835
|
-
uint256 b,
|
|
1836
|
-
uint256 c
|
|
1837
|
-
) public pure returns (uint256) {
|
|
1838
|
-
return (a << b) ^ c;
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
================================================================================
|
|
1843
|
-
`;
|
|
1844
|
-
|
|
1845
|
-
exports[`ShiftRNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
1846
|
-
====================================options=====================================
|
|
1847
|
-
compiler: "0.8.6"
|
|
1848
|
-
parsers: ["solidity-parse"]
|
|
1849
|
-
printWidth: 80
|
|
1850
|
-
| printWidth
|
|
1851
|
-
=====================================input======================================
|
|
1852
|
-
// SPDX-License-Identifier: MIT
|
|
1853
|
-
pragma solidity 0.8.10;
|
|
1854
|
-
|
|
1855
|
-
contract ShiftRNoParentheses {
|
|
1856
|
-
function shiftRAdd(uint256 a, uint256 b, uint256 c)
|
|
1857
|
-
public
|
|
1858
|
-
pure
|
|
1859
|
-
returns (uint256)
|
|
1860
|
-
{
|
|
1861
|
-
return a >> b + c;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
function shiftRSub(uint256 a, uint256 b, uint256 c)
|
|
1865
|
-
public
|
|
1866
|
-
pure
|
|
1867
|
-
returns (uint256)
|
|
1868
|
-
{
|
|
1869
|
-
return a >> b - c;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
function shiftRMul(uint256 a, uint256 b, uint256 c)
|
|
1873
|
-
public
|
|
1874
|
-
pure
|
|
1875
|
-
returns (uint256)
|
|
1876
|
-
{
|
|
1877
|
-
return a >> b * c;
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
function shiftRDiv(uint256 a, uint256 b, uint256 c)
|
|
1881
|
-
public
|
|
1882
|
-
pure
|
|
1883
|
-
returns (uint256)
|
|
1884
|
-
{
|
|
1885
|
-
return a >> b / c;
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
function shiftRMod(uint256 a, uint256 b, uint256 c)
|
|
1889
|
-
public
|
|
1890
|
-
pure
|
|
1891
|
-
returns (uint256)
|
|
1892
|
-
{
|
|
1893
|
-
return a >> b % c;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
function shiftRExp(uint256 a, uint256 b, uint256 c)
|
|
1897
|
-
public
|
|
1898
|
-
pure
|
|
1899
|
-
returns (uint256)
|
|
1900
|
-
{
|
|
1901
|
-
return a >> b ** c;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
function shiftRShiftL(uint256 a, uint256 b, uint256 c)
|
|
1905
|
-
public
|
|
1906
|
-
pure
|
|
1907
|
-
returns (uint256)
|
|
1908
|
-
{
|
|
1909
|
-
return a >> b << c;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
function shiftRShiftR(uint256 a, uint256 b, uint256 c)
|
|
1913
|
-
public
|
|
1914
|
-
pure
|
|
1915
|
-
returns (uint256)
|
|
1916
|
-
{
|
|
1917
|
-
return a >> b >> c;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
function shiftRBitAnd(uint256 a, uint256 b, uint256 c)
|
|
1921
|
-
public
|
|
1922
|
-
pure
|
|
1923
|
-
returns (uint256)
|
|
1924
|
-
{
|
|
1925
|
-
return a >> b & c;
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
function shiftRBitOr(uint256 a, uint256 b, uint256 c)
|
|
1929
|
-
public
|
|
1930
|
-
pure
|
|
1931
|
-
returns (uint256)
|
|
1932
|
-
{
|
|
1933
|
-
return a >> b | c;
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
function shiftRBitXor(uint256 a, uint256 b, uint256 c)
|
|
1937
|
-
public
|
|
1938
|
-
pure
|
|
1939
|
-
returns (uint256)
|
|
1940
|
-
{
|
|
1941
|
-
return a >> b ^ c;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
=====================================output=====================================
|
|
1946
|
-
// SPDX-License-Identifier: MIT
|
|
1947
|
-
pragma solidity 0.8.10;
|
|
1948
|
-
|
|
1949
|
-
contract ShiftRNoParentheses {
|
|
1950
|
-
function shiftRAdd(
|
|
1951
|
-
uint256 a,
|
|
1952
|
-
uint256 b,
|
|
1953
|
-
uint256 c
|
|
1954
|
-
) public pure returns (uint256) {
|
|
1955
|
-
return a >> (b + c);
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
function shiftRSub(
|
|
1959
|
-
uint256 a,
|
|
1960
|
-
uint256 b,
|
|
1961
|
-
uint256 c
|
|
1962
|
-
) public pure returns (uint256) {
|
|
1963
|
-
return a >> (b - c);
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
function shiftRMul(
|
|
1967
|
-
uint256 a,
|
|
1968
|
-
uint256 b,
|
|
1969
|
-
uint256 c
|
|
1970
|
-
) public pure returns (uint256) {
|
|
1971
|
-
return a >> (b * c);
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
|
-
function shiftRDiv(
|
|
1975
|
-
uint256 a,
|
|
1976
|
-
uint256 b,
|
|
1977
|
-
uint256 c
|
|
1978
|
-
) public pure returns (uint256) {
|
|
1979
|
-
return a >> (b / c);
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
function shiftRMod(
|
|
1983
|
-
uint256 a,
|
|
1984
|
-
uint256 b,
|
|
1985
|
-
uint256 c
|
|
1986
|
-
) public pure returns (uint256) {
|
|
1987
|
-
return a >> b % c;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
function shiftRExp(
|
|
1991
|
-
uint256 a,
|
|
1992
|
-
uint256 b,
|
|
1993
|
-
uint256 c
|
|
1994
|
-
) public pure returns (uint256) {
|
|
1995
|
-
return a >> (b**c);
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
function shiftRShiftL(
|
|
1999
|
-
uint256 a,
|
|
2000
|
-
uint256 b,
|
|
2001
|
-
uint256 c
|
|
2002
|
-
) public pure returns (uint256) {
|
|
2003
|
-
return (a >> b) << c;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
function shiftRShiftR(
|
|
2007
|
-
uint256 a,
|
|
2008
|
-
uint256 b,
|
|
2009
|
-
uint256 c
|
|
2010
|
-
) public pure returns (uint256) {
|
|
2011
|
-
return (a >> b) >> c;
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
function shiftRBitAnd(
|
|
2015
|
-
uint256 a,
|
|
2016
|
-
uint256 b,
|
|
2017
|
-
uint256 c
|
|
2018
|
-
) public pure returns (uint256) {
|
|
2019
|
-
return (a >> b) & c;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
function shiftRBitOr(
|
|
2023
|
-
uint256 a,
|
|
2024
|
-
uint256 b,
|
|
2025
|
-
uint256 c
|
|
2026
|
-
) public pure returns (uint256) {
|
|
2027
|
-
return (a >> b) | c;
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
function shiftRBitXor(
|
|
2031
|
-
uint256 a,
|
|
2032
|
-
uint256 b,
|
|
2033
|
-
uint256 c
|
|
2034
|
-
) public pure returns (uint256) {
|
|
2035
|
-
return (a >> b) ^ c;
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
================================================================================
|
|
2040
|
-
`;
|
|
2041
|
-
|
|
2042
|
-
exports[`SubNoParentheses.sol - {"compiler":"0.8.6"} format 1`] = `
|
|
2043
|
-
====================================options=====================================
|
|
2044
|
-
compiler: "0.8.6"
|
|
2045
|
-
parsers: ["solidity-parse"]
|
|
2046
|
-
printWidth: 80
|
|
2047
|
-
| printWidth
|
|
2048
|
-
=====================================input======================================
|
|
2049
|
-
// SPDX-License-Identifier: MIT
|
|
2050
|
-
pragma solidity 0.8.10;
|
|
2051
|
-
|
|
2052
|
-
contract SubNoParentheses {
|
|
2053
|
-
function subAdd(uint256 a, uint256 b, uint256 c)
|
|
2054
|
-
public
|
|
2055
|
-
pure
|
|
2056
|
-
returns (uint256)
|
|
2057
|
-
{
|
|
2058
|
-
return a - b + c;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
function subSub(uint256 a, uint256 b, uint256 c)
|
|
2062
|
-
public
|
|
2063
|
-
pure
|
|
2064
|
-
returns (uint256)
|
|
2065
|
-
{
|
|
2066
|
-
return a - b - c;
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
function subMul(uint256 a, uint256 b, uint256 c)
|
|
2070
|
-
public
|
|
2071
|
-
pure
|
|
2072
|
-
returns (uint256)
|
|
2073
|
-
{
|
|
2074
|
-
return a - b * c;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
function subDiv(uint256 a, uint256 b, uint256 c)
|
|
2078
|
-
public
|
|
2079
|
-
pure
|
|
2080
|
-
returns (uint256)
|
|
2081
|
-
{
|
|
2082
|
-
return a - b / c;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
function subMod(uint256 a, uint256 b, uint256 c)
|
|
2086
|
-
public
|
|
2087
|
-
pure
|
|
2088
|
-
returns (uint256)
|
|
2089
|
-
{
|
|
2090
|
-
return a - b % c;
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
function subExp(uint256 a, uint256 b, uint256 c)
|
|
2094
|
-
public
|
|
2095
|
-
pure
|
|
2096
|
-
returns (uint256)
|
|
2097
|
-
{
|
|
2098
|
-
return a - b ** c;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
function subShiftL(uint256 a, uint256 b, uint256 c)
|
|
2102
|
-
public
|
|
2103
|
-
pure
|
|
2104
|
-
returns (uint256)
|
|
2105
|
-
{
|
|
2106
|
-
return a - b << c;
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
function subShiftR(uint256 a, uint256 b, uint256 c)
|
|
2110
|
-
public
|
|
2111
|
-
pure
|
|
2112
|
-
returns (uint256)
|
|
2113
|
-
{
|
|
2114
|
-
return a - b >> c;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
function subBitAnd(uint256 a, uint256 b, uint256 c)
|
|
2118
|
-
public
|
|
2119
|
-
pure
|
|
2120
|
-
returns (uint256)
|
|
2121
|
-
{
|
|
2122
|
-
return a - b & c;
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
function subBitOr(uint256 a, uint256 b, uint256 c)
|
|
2126
|
-
public
|
|
2127
|
-
pure
|
|
2128
|
-
returns (uint256)
|
|
2129
|
-
{
|
|
2130
|
-
return a - b | c;
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
function subBitXor(uint256 a, uint256 b, uint256 c)
|
|
2134
|
-
public
|
|
2135
|
-
pure
|
|
2136
|
-
returns (uint256)
|
|
2137
|
-
{
|
|
2138
|
-
return a - b ^ c;
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
=====================================output=====================================
|
|
2143
|
-
// SPDX-License-Identifier: MIT
|
|
2144
|
-
pragma solidity 0.8.10;
|
|
2145
|
-
|
|
2146
|
-
contract SubNoParentheses {
|
|
2147
|
-
function subAdd(
|
|
2148
|
-
uint256 a,
|
|
2149
|
-
uint256 b,
|
|
2150
|
-
uint256 c
|
|
2151
|
-
) public pure returns (uint256) {
|
|
2152
|
-
return a - b + c;
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
function subSub(
|
|
2156
|
-
uint256 a,
|
|
2157
|
-
uint256 b,
|
|
2158
|
-
uint256 c
|
|
2159
|
-
) public pure returns (uint256) {
|
|
2160
|
-
return a - b - c;
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
function subMul(
|
|
2164
|
-
uint256 a,
|
|
2165
|
-
uint256 b,
|
|
2166
|
-
uint256 c
|
|
2167
|
-
) public pure returns (uint256) {
|
|
2168
|
-
return a - b * c;
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
function subDiv(
|
|
2172
|
-
uint256 a,
|
|
2173
|
-
uint256 b,
|
|
2174
|
-
uint256 c
|
|
2175
|
-
) public pure returns (uint256) {
|
|
2176
|
-
return a - b / c;
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
function subMod(
|
|
2180
|
-
uint256 a,
|
|
2181
|
-
uint256 b,
|
|
2182
|
-
uint256 c
|
|
2183
|
-
) public pure returns (uint256) {
|
|
2184
|
-
return a - (b % c);
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
function subExp(
|
|
2188
|
-
uint256 a,
|
|
2189
|
-
uint256 b,
|
|
2190
|
-
uint256 c
|
|
2191
|
-
) public pure returns (uint256) {
|
|
2192
|
-
return a - b**c;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
function subShiftL(
|
|
2196
|
-
uint256 a,
|
|
2197
|
-
uint256 b,
|
|
2198
|
-
uint256 c
|
|
2199
|
-
) public pure returns (uint256) {
|
|
2200
|
-
return (a - b) << c;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
function subShiftR(
|
|
2204
|
-
uint256 a,
|
|
2205
|
-
uint256 b,
|
|
2206
|
-
uint256 c
|
|
2207
|
-
) public pure returns (uint256) {
|
|
2208
|
-
return (a - b) >> c;
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
function subBitAnd(
|
|
2212
|
-
uint256 a,
|
|
2213
|
-
uint256 b,
|
|
2214
|
-
uint256 c
|
|
2215
|
-
) public pure returns (uint256) {
|
|
2216
|
-
return (a - b) & c;
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
function subBitOr(
|
|
2220
|
-
uint256 a,
|
|
2221
|
-
uint256 b,
|
|
2222
|
-
uint256 c
|
|
2223
|
-
) public pure returns (uint256) {
|
|
2224
|
-
return (a - b) | c;
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
function subBitXor(
|
|
2228
|
-
uint256 a,
|
|
2229
|
-
uint256 b,
|
|
2230
|
-
uint256 c
|
|
2231
|
-
) public pure returns (uint256) {
|
|
2232
|
-
return (a - b) ^ c;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
================================================================================
|
|
2237
|
-
`;
|