From 348c26aa7d3b6b42d48997b903fdea9ebcceefdf Mon Sep 17 00:00:00 2001 From: achmizs <1874748+achmizs@users.noreply.github.com> Date: Sat, 4 Dec 2021 19:16:46 -0500 Subject: [PATCH] Code/comment cleanup --- SA_DiceFormatter.m | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/SA_DiceFormatter.m b/SA_DiceFormatter.m index 91cdea9..223b5a9 100644 --- a/SA_DiceFormatter.m +++ b/SA_DiceFormatter.m @@ -145,9 +145,11 @@ static NSDictionary *_stringFormatRules; // only if error reporting is enabled. if (expression.result != nil) { [formattedString appendFormat:@" = %@", expression.result]; - } else if (_legacyModeErrorReportingEnabled == YES && - expression.errorBitMask != 0) { - [formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1) ? @" [ERROR: %@]" : @" [ERRORS: %@]"), + } else if ( _legacyModeErrorReportingEnabled == YES + && expression.errorBitMask != 0) { + [formattedString appendFormat:((__builtin_popcountl(expression.errorBitMask) == 1) + ? @" [ERROR: %@]" + : @" [ERRORS: %@]"), [SA_DiceFormatter descriptionForErrors:expression.errorBitMask]]; } @@ -167,7 +169,7 @@ static NSDictionary *_stringFormatRules; is printed along with the rolls. For this reasons, when we recursively retrieve the string representations - of sub-expressions, we call this method, not legacyStringFromExpression:. + of sub-expressions, we call this method, not -[legacyStringFromExpression:]. */ switch (expression.type) { @@ -352,9 +354,10 @@ static NSDictionary *_stringFormatRules; } NSMutableArray *errorDescriptions = [NSMutableArray array]; - for (int i = 0; i <= 18; i++) { - if ((errorBitMask & 1 << i) == 0) continue; - NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) 1 << i); + for (int i = 0; i <= 19; i++) { + if ((errorBitMask & (1 << i)) == 0) + continue; + NSString *errorName = NSStringFromSA_DiceExpressionError((SA_DiceExpressionError) (1 << i)); [errorDescriptions addObject:(_errorDescriptions[errorName] ?: errorName)]; }