C conversion to unsigned types implictly mods

This commit is contained in:
Juhani Krekelä 2021-04-08 20:25:07 +03:00
parent 264f6fd44e
commit cf2b617b39
1 changed files with 3 additions and 3 deletions

6
puer.c
View File

@ -56,9 +56,9 @@ uint32_t bytes2word(unsigned char const bytes[4]) {
}
void word2bytes(unsigned char *bytes, uint32_t word) {
bytes[0] = word & 0xff;
bytes[1] = word>>8 & 0xff;
bytes[2] = word>>16 & 0xff;
bytes[0] = word;
bytes[1] = word>>8;
bytes[2] = word>>16;
bytes[3] = word>>24;
}