summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-14 05:34:17 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-14 05:34:17 -0400
commite37de01df5aaf6161cd88424cb522f590355f5d8 (patch)
tree58100ce4ee258635e5cf3bd5a31f97c835ed7716 /bits.c
parent29f16317f536d8f525bff3a3b8f9541076fab550 (diff)
downloadgpsd-e37de01df5aaf6161cd88424cb522f590355f5d8.tar.gz
Reindented some small utility modules. All regression tests pass.
Diffstat (limited to 'bits.c')
-rw-r--r--bits.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/bits.c b/bits.c
index e2e2e901..4e5299a6 100644
--- a/bits.c
+++ b/bits.c
@@ -27,14 +27,15 @@ unsigned long long ubits(char buf[], unsigned int start, unsigned int width)
unsigned int i;
unsigned end;
- /*@i1@*/assert(width <= sizeof(long long) * BITS_PER_BYTE);
- for (i = start / BITS_PER_BYTE; i < (start + width + BITS_PER_BYTE - 1) / BITS_PER_BYTE; i++) {
+ /*@i1@*/ assert(width <= sizeof(long long) * BITS_PER_BYTE);
+ for (i = start / BITS_PER_BYTE;
+ i < (start + width + BITS_PER_BYTE - 1) / BITS_PER_BYTE; i++) {
fld <<= BITS_PER_BYTE;
fld |= (unsigned char)buf[i];
}
#ifdef DEBUG
(void)printf("%d:%d from %s:\n", start, width, gpsd_hexdump(buf, 32));
-#endif
+#endif
#ifdef DEBUG
(void)printf(" segment=0x%llx,", fld);
@@ -43,7 +44,7 @@ unsigned long long ubits(char buf[], unsigned int start, unsigned int width)
if (end != 0) {
fld >>= (BITS_PER_BYTE - end);
#ifdef DEBUG
- (void)printf(" after downshifting by %d bits: 0x%llx",
+ (void)printf(" after downshifting by %d bits: 0x%llx",
BITS_PER_BYTE - end, fld);
#endif /* UDEBUG */
}
@@ -55,8 +56,9 @@ unsigned long long ubits(char buf[], unsigned int start, unsigned int width)
fld &= ~(-1LL << width);
/*@ +shiftimplementation @*/
#ifdef DEBUG
- (void)printf(" after selecting out the bottom %u bits: 0x%llx = %lld\n",
- width, fld, fld);
+ (void)
+ printf(" after selecting out the bottom %u bits: 0x%llx = %lld\n",
+ width, fld, fld);
#endif /* DEBUG */
return fld;
@@ -71,18 +73,18 @@ signed long long sbits(char buf[], unsigned int start, unsigned int width)
(void)fprintf(stderr, "sbits(%d, %d) extracts %llx\n", start, width, fld);
#endif /* SDEBUG */
/*@ +relaxtypes */
- if (fld & (1 << (width-1))) {
+ if (fld & (1 << (width - 1))) {
#ifdef SDEBUG
(void)fprintf(stderr, "%llx is signed\n", fld);
#endif /* SDEBUG */
/*@ -shiftimplementation @*/
- fld |= (-1LL << (width-1));
+ fld |= (-1LL << (width - 1));
/*@ +shiftimplementation @*/
}
#ifdef SDEBUG
- (void)fprintf(stderr, "sbits(%d, %d) returns %lld\n", start, width, (signed long long)fld);
+ (void)fprintf(stderr, "sbits(%d, %d) returns %lld\n", start, width,
+ (signed long long)fld);
#endif /* SDEBUG */
return (signed long long)fld;
/*@ -relaxtypes */
}
-