ein wenig mehr arg

This commit is contained in:
Johannes Theiner 2018-04-09 21:12:50 +02:00
parent 62ba64f67a
commit 69d767ce42
1 changed files with 4 additions and 6 deletions

View File

@ -94,13 +94,11 @@ PascalString bitwiseDualAnd(PascalString a, PascalString b) {
} }
PascalString bitwiseHexAnd(PascalString a, PascalString b) { PascalString bitwiseHexAnd(PascalString a, PascalString b) {
PascalString shortString = a.length < b.length ? a : b; PascalString result = {a.length, '0'};
PascalString longString = a.length > b.length ? a : b;
PascalString result = {longString.length, '0'};
for(int i = longString.length; i >= 0; --i) { for(int i = a.length; i >= 0; --i) {
if(shortString.length < i) result.characters[i] = longString.characters[i]; if(b.length < i) result.characters[i] = a.characters[i];
result.characters[i] = longString.characters[i] & shortString.characters[i]; result.characters[i] = a.characters[i] & b.characters[i];
} }
return result; return result;