diff options
-rw-r--r-- | payloads/libpayload/include/endian.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/payloads/libpayload/include/endian.h b/payloads/libpayload/include/endian.h index 2655634c93..2dcfa1f8da 100644 --- a/payloads/libpayload/include/endian.h +++ b/payloads/libpayload/include/endian.h @@ -132,8 +132,8 @@ static inline void bebitenc(void *pp, uint32_t u, uint8_t b) uint8_t *p = (uint8_t *)pp; int i; - for (i = (b - 1); i >= 0; i++) - p[i] = (u >> i*8) & 0xFF; + for (i = 0; i < b; i++) + p[(b - 1) - i] = (u >> i*8) & 0xFF; } static inline void be16enc(void *pp, uint16_t u) |