gosh dammit
This commit is contained in:
parent
a4255c3bb2
commit
a3f4c78465
|
@ -56,16 +56,22 @@ PascalString intToDual(int n) {
|
|||
char intToHexChar(int n) {
|
||||
if (n > 9) {
|
||||
switch (n) {
|
||||
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';
|
||||
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';
|
||||
}
|
||||
}
|
||||
else return n + '0';
|
||||
} else return n + '0';
|
||||
}
|
||||
|
||||
PascalString intToHex(int n) {
|
||||
|
@ -81,13 +87,11 @@ PascalString intToHex(int n) {
|
|||
}
|
||||
|
||||
PascalString bitwiseDualAnd(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 = b.length; i >= 0; --i) {
|
||||
if (a.length < i) result.characters[i] = a.characters[i];
|
||||
result.characters[i] = a.characters[i] & b.characters[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -98,7 +102,6 @@ PascalString bitwiseHexAnd(PascalString a, PascalString b) {
|
|||
|
||||
for (int i = b.length; i >= 0; --i) {
|
||||
if (a.length < i) result.characters[i] = a.characters[i];
|
||||
println("i: ", i, " ", a.characters[i] & b.characters[i]);
|
||||
result.characters[i] = a.characters[i] & b.characters[i];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue