binarybuffer: move variables to point of first use

Reduce some noise from subsequent patches.
This commit is contained in:
Zachary T Welch
2009-11-14 08:19:24 -08:00
parent 82fc2f9628
commit 5a43bd2e18
2 changed files with 9 additions and 28 deletions

View File

@@ -39,8 +39,7 @@ static inline void buf_set_u32(uint8_t* buffer,
buffer[1] = (value >> 8) & 0xff;
buffer[0] = (value >> 0) & 0xff;
} else {
unsigned int i;
for (i = first; i < first + num; i++)
for (unsigned i = first; i < first + num; i++)
{
if (((value >> (i - first)) & 1) == 1)
buffer[i / 8] |= 1 << (i % 8);
@@ -59,8 +58,7 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer,
(((uint32_t)buffer[0]) << 0);
} else {
uint32_t result = 0;
unsigned int i;
for (i = first; i < first + num; i++)
for (unsigned i = first; i < first + num; i++)
{
if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
result |= 1 << (i - first);