I have a char array:
char message[];
And an 8-bit integer
uint8_t remainder
I want to treat both just as arrays of bits and subtract them like:
message - remainder
and treat the result as a char array:
An example would be
char* message = "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ";
// Equivalent to a 512-bit array of only 1s
uint8_t remainder = 1;
// Substract here message-remainder
printf("%s", message)
// Output: "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ"
// As the 512 bit array would still be just 1s except for the first bit which now is 0, so the first char would be 254 instead of 255
Is there a possible way to do it? I thought about converting the char array to an int but the problem is that it usually is a 64 byte array, so I cannot treat is an int. I think the approach goes around using bitwise operators but I haven't figured how to subtract them yet.
Any suggestions?