Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/bta2dpd/sbc_crc-gen KNF.
details: https://anonhg.NetBSD.org/src/rev/817c88de5c12
branches: trunk
changeset: 351008:817c88de5c12
user: christos <christos%NetBSD.org@localhost>
date: Mon Jan 30 15:56:44 2017 +0000
description:
KNF.
diffstat:
usr.sbin/bta2dpd/sbc_crc-gen/sbc_crc.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (57 lines):
diff -r 39493879d468 -r 817c88de5c12 usr.sbin/bta2dpd/sbc_crc-gen/sbc_crc.c
--- a/usr.sbin/bta2dpd/sbc_crc-gen/sbc_crc.c Mon Jan 30 15:50:21 2017 +0000
+++ b/usr.sbin/bta2dpd/sbc_crc-gen/sbc_crc.c Mon Jan 30 15:56:44 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_crc.c,v 1.2 2017/01/30 14:55:17 jakllsch Exp $ */
+/* $NetBSD: sbc_crc.c,v 1.3 2017/01/30 15:56:44 christos Exp $ */
/*-
* Copyright (c) 2015 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -34,10 +34,9 @@
#include <stdio.h>
int
-main()
+main(void)
{
- int j, i, k, numbits;
- unsigned int data;
+ unsigned int j, i, k, numbits, data;
printf("/* sbc_crc.h - Automatically generated by sbc_crc.c. */\n\n");
@@ -45,26 +44,26 @@
numbits = 8;
for (k = 0; k < 2; k++) {
- printf("static const uint8_t sbc_crc%d[256] = {\n ",numbits);
+ printf("static const uint8_t sbc_crc%u[256] = {\n\t", numbits);
for (i = 0; i < 256; i++) {
data = i;
for (j = 0; j < numbits; j++) {
- if (data & 0x80){
- data = data << 1;
- data = (data ^ 0x1d);
+ if (data & 0x80) {
+ data <<= 1;
+ data ^= 0x1d;
} else
- data = data << 1;
+ data <<= 1;
}
if (i % 8 == 0 && i != 0)
- printf("\n ");
+ printf("\n\t");
- printf("0x%02x, ",data & 0xff);
+ printf("0x%02x, ", data & 0xff);
}
printf("\n};\n\n");
- numbits = 4;
+ numbits /= 2;
}
return 0;
}
Home |
Main Index |
Thread Index |
Old Index