aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2014-06-19 21:43:16 +0200
committerMichael Mann <mmann78@netscape.net>2014-06-19 19:56:33 +0000
commit9e81d5820a8eb8d7d05d5c5845e6a07d98659ce1 (patch)
tree98e614f4798756563c08729701b4a13ee94c6e11 /epan
parent15a0a6315641cba55363ba6ef4769b27ffc90ccb (diff)
Fix indent (use 4 spaces) and add modelines
Change-Id: Ieb231d9f551f3e157197f56378088fb0069388d3 Reviewed-on: https://code.wireshark.org/review/2455 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r--epan/golay.c77
-rw-r--r--epan/golay.h13
2 files changed, 58 insertions, 32 deletions
diff --git a/epan/golay.c b/epan/golay.c
index a033423e1a..869a3c96bf 100644
--- a/epan/golay.c
+++ b/epan/golay.c
@@ -75,18 +75,18 @@ static const guint golay_encode_matrix[12] = {
};
static const guint golay_decode_matrix[12] = {
- 0x49F,
- 0x93E,
- 0x6E3,
- 0xDC6,
- 0xF13,
- 0xAB9,
- 0x1ED,
- 0x3DA,
- 0x7B4,
- 0xF68,
- 0xA4F,
- 0xC75,
+ 0x49F,
+ 0x93E,
+ 0x6E3,
+ 0xDC6,
+ 0xF13,
+ 0xAB9,
+ 0x1ED,
+ 0x3DA,
+ 0x7B4,
+ 0xF68,
+ 0xA4F,
+ 0xC75,
};
@@ -97,8 +97,8 @@ static guint weight12(guint vector)
guint w=0;
guint i;
for( i=0; i<12; i++ )
- if( vector & 1<<i )
- w++;
+ if( vector & 1<<i )
+ w++;
return w;
}
@@ -109,8 +109,8 @@ static guint golay_coding(guint w)
guint i;
for( i = 0; i<12; i++ ) {
- if( w & 1<<i )
- out ^= golay_encode_matrix[i];
+ if( w & 1<<i )
+ out ^= golay_encode_matrix[i];
}
return out;
}
@@ -130,8 +130,8 @@ static guint golay_decoding(guint w)
guint i;
for( i = 0; i<12; i++ ) {
- if( w & 1<<(i) )
- out ^= golay_decode_matrix[i];
+ if( w & 1<<(i) )
+ out ^= golay_decode_matrix[i];
}
return out;
}
@@ -181,7 +181,7 @@ gint32 golay_errors(guint32 codeword)
* latter).
*/
if( w <= 3 ) {
- return ((gint32) syndrome)<<12;
+ return ((gint32) syndrome)<<12;
}
/* the next thing to try is one error in the data bits.
@@ -192,11 +192,11 @@ gint32 golay_errors(guint32 codeword)
* closer to another codeword. */
for( i = 0; i<12; i++ ) {
- guint error = 1<<i;
- guint coding_error = golay_encode_matrix[i];
- if( weight12(syndrome^coding_error) <= 2 ) {
- return (gint32)((((guint32)(syndrome^coding_error))<<12) | (guint32)error) ;
- }
+ guint error = 1<<i;
+ guint coding_error = golay_encode_matrix[i];
+ if( weight12(syndrome^coding_error) <= 2 ) {
+ return (gint32)((((guint32)(syndrome^coding_error))<<12) | (guint32)error) ;
+ }
}
/* okay then, let's see whether the parity bits are error free, and all the
@@ -219,18 +219,18 @@ gint32 golay_errors(guint32 codeword)
inv_syndrome = golay_decoding(syndrome);
w = weight12(inv_syndrome);
if( w <=3 ) {
- return (gint32)inv_syndrome;
+ return (gint32)inv_syndrome;
}
/* Final shot: try with 2 errors in the data bits, and 1 in the parity
* bits; as before we try each of the bits in the parity in turn */
for( i = 0; i<12; i++ ) {
- guint error = 1<<i;
- guint coding_error = golay_decode_matrix[i];
- if( weight12(inv_syndrome^coding_error) <= 2 ) {
- guint32 error_word = ((guint32)(inv_syndrome^coding_error)) | ((guint32)error)<<12;
- return (gint32)error_word;
- }
+ guint error = 1<<i;
+ guint coding_error = golay_decode_matrix[i];
+ if( weight12(inv_syndrome^coding_error) <= 2 ) {
+ guint32 error_word = ((guint32)(inv_syndrome^coding_error)) | ((guint32)error)<<12;
+ return (gint32)error_word;
+ }
}
/* uncorrectable error */
@@ -250,7 +250,20 @@ gint golay_decode(guint32 w)
guint data_errors;
if( errors == -1 )
- return -1;
+ return -1;
data_errors = (guint)errors & 0xfff;
return (gint)(data ^ data_errors);
}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/golay.h b/epan/golay.h
index e64c091492..443718e008 100644
--- a/epan/golay.h
+++ b/epan/golay.h
@@ -51,3 +51,16 @@ WS_DLL_PUBLIC
gint golay_decode(guint32 w);
#endif
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */