diff --git a/02_MENT/main_02_MENT.cpp b/02_MENT/main_02_MENT.cpp index d4ed3dc..4844b36 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -94,13 +94,11 @@ PascalString bitwiseDualAnd(PascalString a, PascalString b) { } PascalString bitwiseHexAnd(PascalString a, PascalString b) { - PascalString shortString = a.length < b.length ? a : b; - PascalString longString = a.length > b.length ? a : b; - PascalString result = {longString.length, '0'}; + PascalString result = {a.length, '0'}; - for(int i = longString.length; i >= 0; --i) { - if(shortString.length < i) result.characters[i] = longString.characters[i]; - result.characters[i] = longString.characters[i] & shortString.characters[i]; + for(int i = a.length; i >= 0; --i) { + if(b.length < i) result.characters[i] = a.characters[i]; + result.characters[i] = a.characters[i] & b.characters[i]; } return result;