Skip to content

Commit

Permalink
Fix storage of multi-byte integers on big endian machines.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schik committed Jan 8, 2021
1 parent 395f824 commit 9451b75
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 9451b75

Please sign in to comment.