This commit is contained in:
s2ks 2022-07-08 01:37:42 +02:00
parent 063da8aa60
commit b27e7d00fe
2 changed files with 3 additions and 3 deletions

@ -1291,8 +1291,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
"Note 2: Index 0 is an 'overall' parity bit. Watch the Hamming code video from 3Blue1Brown for more information\n",
"Note 3: There's a ~55% chance for an altered Bit. So... MAYBE there is an altered Bit 😉\n",
"Note: The endianness of the encoded decimal value is reversed in relation to the endianness of the Hamming code. Where",
"the Hamming code is expressed as little-endian (LSB at index 0), the decimal value encoded in it is expressed as big-endian",
"(MSB at index 0).\n",
"the Hamming code is expressed as little-endian (LSB at index 0), the decimal value encoded in it is expressed as big-endian",
"(MSB at index 0).\n",
"Extra note for automation: return the decimal value as a string",
].join(" ");
},

@ -60,7 +60,7 @@ export function HammingEncodeProperly(data: number): string {
let m = 1;
while (((2**((2**m) - m - 1)) - 1) < data) {
while (2 ** (2 ** m - m - 1) - 1 < data) {
m++;
}