summaryrefslogtreecommitdiff
path: root/src/helper/binarybuffer.h
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-14 08:19:24 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 00:46:33 -0800
commit5a43bd2e185bf469561a8370dcd543cc4813c33f (patch)
treee2167a12e6507090a3ef6c70a874fd7c86a31586 /src/helper/binarybuffer.h
parent82fc2f9628e0f1dbd9010e0146ff63832e4a77a1 (diff)
downloadopenocd+libswd-5a43bd2e185bf469561a8370dcd543cc4813c33f.tar.gz
openocd+libswd-5a43bd2e185bf469561a8370dcd543cc4813c33f.tar.bz2
openocd+libswd-5a43bd2e185bf469561a8370dcd543cc4813c33f.tar.xz
openocd+libswd-5a43bd2e185bf469561a8370dcd543cc4813c33f.zip
binarybuffer: move variables to point of first use
Reduce some noise from subsequent patches.
Diffstat (limited to 'src/helper/binarybuffer.h')
-rw-r--r--src/helper/binarybuffer.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h
index 60077b31..400cbbe6 100644
--- a/src/helper/binarybuffer.h
+++ b/src/helper/binarybuffer.h
@@ -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);