From 69d767ce426582c8caa79d9e3e112403814d8507 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 9 Apr 2018 21:12:50 +0200 Subject: [PATCH] ein wenig mehr arg --- 02_MENT/main_02_MENT.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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;