und weiter geht der Spaß
This commit is contained in:
parent
37a116cf63
commit
b75b7e169a
|
@ -80,13 +80,18 @@ PascalString intToHex(int n) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getInt(char character) {
|
||||||
|
if(character == '0') return character;
|
||||||
|
else return '1';
|
||||||
|
}
|
||||||
|
|
||||||
PascalString bitwiseDualAnd(PascalString a, PascalString b) {
|
PascalString bitwiseDualAnd(PascalString a, PascalString b) {
|
||||||
PascalString result = {a.length, '0'};
|
PascalString result = {a.length, '0'};
|
||||||
|
|
||||||
for(int i = b.length; i >= 0; --i) {
|
for(int i = b.length; i >= 0; --i) {
|
||||||
if(a.length < i) result.characters[i] = a.characters[i];
|
if(a.length < i) result.characters[i] = a.characters[i];
|
||||||
println("i: ", i, " ", a.characters[i] & b.characters[i]);
|
println("i: ", i, " ", intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i])));
|
||||||
result.characters[i] = a.characters[i] & b.characters[i];
|
result.characters[i] = intToHexChar(getInt(a.characters[i]) & getInt(b.characters[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue