Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd8ea67

Browse filesBrowse files
committed
EssentialType: Reduce duplication in conditional calc
Avoid repeating code for both the signed and unsigned cases.
1 parent 62da9c8 commit cd8ea67
Copy full SHA for cd8ea67

File tree

Expand file treeCollapse file tree

1 file changed

+3
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-11
lines changed

‎c/misra/src/codingstandards/c/misra/EssentialTypes.qll

Copy file name to clipboardExpand all lines: c/misra/src/codingstandards/c/misra/EssentialTypes.qll
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,13 @@ class EssentialConditionalExpr extends EssentialExpr, ConditionalExpr {
267267
then result = thenEssentialType
268268
else
269269
if
270-
getEssentialTypeCategory(thenEssentialType) = EssentiallySignedType() and
271-
getEssentialTypeCategory(elseEssentialType) = EssentiallySignedType()
270+
getEssentialTypeCategory(thenEssentialType) = getEssentialTypeCategory(elseEssentialType) and
271+
getEssentialTypeCategory(thenEssentialType) instanceof EssentiallySignedOrUnsignedType
272272
then
273273
if thenEssentialType.getSize() > elseEssentialType.getSize()
274274
then result = thenEssentialType
275275
else result = elseEssentialType
276-
else
277-
if
278-
getEssentialTypeCategory(thenEssentialType) = EssentiallyUnsignedType() and
279-
getEssentialTypeCategory(elseEssentialType) = EssentiallyUnsignedType()
280-
then
281-
if thenEssentialType.getSize() > elseEssentialType.getSize()
282-
then result = thenEssentialType
283-
else result = elseEssentialType
284-
else result = this.getStandardType()
276+
else result = this.getStandardType()
285277
)
286278
}
287279
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.