-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Description
in encoding.h:
`
/* encode 32 bits unsigned int (lsb) */
inline byte *encode32u(byte *p, uint32_t l)
{
#if IWORDS_BIG_ENDIAN
*(unsigned char*)(p + 0) = (unsigned char)((l >> 0) & 0xff);
*(unsigned char*)(p + 1) = (unsigned char)((l >> 8) & 0xff);
*(unsigned char*)(p + 2) = (unsigned char)((l >> 16) & 0xff);
*(unsigned char*)(p + 3) = (unsigned char)((l >> 24) & 0xff);
#else
*(int32_t*)p = l;
#endif
p += 4;
return p;
}
/* Decode 32 bits unsigned int (lsb) */
inline byte *decode32u(byte *p, uint32_t *l)
{
#if IWORDS_BIG_ENDIAN
*l = *(const unsigned char*)(p + 3);
*l = *(const unsigned char*)(p + 2) + (*l << 8);
*l = *(const unsigned char*)(p + 1) + (*l << 8);
*l = *(const unsigned char*)(p + 0) + (*l << 8);
#else
*l = *(const int32_t*)p;
#endif
p += 4;
return p;
}`
I think we should use "const uint32_t*" to replace "const int32_t*". Same as "int32_t" and "uint32_t".
Metadata
Metadata
Assignees
Labels
No labels