Skip to content

Commit

Permalink
Merge pull request clwi#10 from schik/big_endian
Browse files Browse the repository at this point in the history
Fix storage of multi-byte integers on big endian machines.
  • Loading branch information
clwi authored Jan 10, 2021
2 parents 395f824 + 9451b75 commit 4320cb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cwpack_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@

#ifdef COMPILE_FOR_BIG_ENDIAN

#define cw_store16(x) *(uint16_t*)p = *(uint16_t*)&x;
#define cw_store32(x) *(uint32_t*)p = *(uint32_t*)&x;
#define cw_store16(x) *(uint16_t*)p = (uint16_t)x;
#define cw_store32(x) *(uint32_t*)p = (uint32_t)x;
#ifndef FORCE_ALIGNMENT_64BIT
#define cw_store64(x) *(uint64_t*)p = *(uint64_t*)&x;
#define cw_store64(x) *(uint64_t*)p = (uint64_t)x;
#else
#define cw_store64(x) memcpy(p,&x,8);
#endif
Expand Down

0 comments on commit 4320cb8

Please sign in to comment.