Skip to content

Instantly share code, notes, and snippets.

@mutkuensert
Created May 27, 2025 20:35
Show Gist options
  • Save mutkuensert/e8cfaa29b0d12678adc711fcd2646a28 to your computer and use it in GitHub Desktop.
Save mutkuensert/e8cfaa29b0d12678adc711fcd2646a28 to your computer and use it in GitHub Desktop.
#include <iostream>
uint8_t mod256(uint16_t value) {
return static_cast<uint8_t>(value % 256);
}
int main() {
uint16_t sum = 0x02+ 0x01+ 0x00+0xFF+ 0xFF;
uint8_t result = mod256(sum);
std::cout <<std::hex<< static_cast<int>(result) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment