From 1194294d2e927ea7a7b9c7dd65defd80f6855514 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 9 Apr 2018 22:14:48 +0200 Subject: [PATCH] dafuq --- 02_MENT/main_02_MENT.cpp | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/02_MENT/main_02_MENT.cpp b/02_MENT/main_02_MENT.cpp index 194f4a0..becb934 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -52,28 +52,6 @@ PascalString intToDual(int n) { return string; } -char intToHexChar(int n) { - switch(n) { - case 0: return '0'; - case 1: return '1'; - case 2: return '2'; - case 3: return '3'; - case 4: return '4'; - case 5: return '5'; - case 6: return '6'; - case 7: return '7'; - case 8: return '8'; - case 9: return '9'; - case 10: return 'A'; - case 11: return 'B'; - case 12: return 'C'; - case 13: return 'D'; - case 14: return 'E'; - case 15: return 'F'; - default: return 'X'; - } -} - PascalString intToHex(int n) { int i = std::to_string(n).length(); PascalString string = {i}; @@ -94,10 +72,10 @@ int getInt(char character) { PascalString bitwiseDualAnd(PascalString a, PascalString b) { PascalString result = {a.length, '0'}; - for(int i = b.length; i >= 0; --i) { + for(int i = a.length; i >= 0; --i) { if(a.length < i) result.characters[i] = a.characters[i]; - println("i: ", i, " ", intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i]))); - result.characters[i] = intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i])); + println("i: ", i, " ", getInt(a.characters[i]) & getInt(b.characters[i])); + result.characters[i] = getInt(a.characters[i]) & getInt(b.characters[i]); } return result;