Skip to content

Commit 2dc9b85

Browse files
committed
Change u_int64_t to uint64_t, etc in rabinpoly
These were throwing doxygen off.
1 parent cc0ab69 commit 2dc9b85

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

src/shared/msb.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ const char bytemsb[0x100] = {
4545
};
4646

4747
/* Find last set (most significant bit) */
48-
static inline u_int fls32 (u_int32_t) __attribute__ ((const));
49-
static inline u_int
50-
fls32 (u_int32_t v)
48+
static inline unsigned int fls32 (uint32_t) __attribute__ ((const));
49+
static inline unsigned int
50+
fls32 (uint32_t v)
5151
{
5252
if (v & 0xffff0000) {
5353
if (v & 0xff000000)
@@ -62,27 +62,27 @@ fls32 (u_int32_t v)
6262
}
6363

6464
/* Ceiling of log base 2 */
65-
static inline int log2c32 (u_int32_t) __attribute__ ((const));
65+
static inline int log2c32 (uint32_t) __attribute__ ((const));
6666
static inline int
67-
log2c32 (u_int32_t v)
67+
log2c32 (uint32_t v)
6868
{
6969
return v ? (int) fls32 (v - 1) : -1;
7070
}
7171

72-
static inline u_int fls64 (u_int64_t) __attribute__ ((const));
73-
static inline u_int
74-
fls64 (u_int64_t v)
72+
static inline unsigned int fls64 (uint64_t) __attribute__ ((const));
73+
static inline unsigned int
74+
fls64 (uint64_t v)
7575
{
76-
u_int32_t h;
76+
uint32_t h;
7777
if ((h = v >> 32))
7878
return 32 + fls32 (h);
7979
else
80-
return fls32 ((u_int32_t) v);
80+
return fls32 ((uint32_t) v);
8181
}
8282

83-
static inline int log2c64 (u_int64_t) __attribute__ ((const));
83+
static inline int log2c64 (uint64_t) __attribute__ ((const));
8484
static inline int
85-
log2c64 (u_int64_t v)
85+
log2c64 (uint64_t v)
8686
{
8787
return v ? (int) fls64 (v - 1) : -1;
8888
}
@@ -97,8 +97,8 @@ log2c64 (u_int64_t v)
9797

9898
EXTERN_C const char bytelsb[];
9999

100-
static inline u_int
101-
ffs32 (u_int32_t v)
100+
static inline unsigned int
101+
ffs32 (uint32_t v)
102102
{
103103
if (v & 0xffff) {
104104
if (int vv = v & 0xff)
@@ -114,10 +114,10 @@ ffs32 (u_int32_t v)
114114
return 0;
115115
}
116116

117-
static inline u_int
118-
ffs64 (u_int64_t v)
117+
static inline unsigned int
118+
ffs64 (uint64_t v)
119119
{
120-
u_int32_t l;
120+
uint32_t l;
121121
if ((l = v & 0xffffffff))
122122
return fls32 (l);
123123
else if ((l = v >> 32))

src/shared/rabinpoly.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include <inttypes.h>
2020

21-
#include "rabinpoly.h"
22-
#include "msb.h"
21+
#include <shared/rabinpoly.h>
22+
#include <shared/msb.h>
2323
#ifndef INT64
2424
# define INT64(n) n##LL
2525
#endif

src/shared/rabinpoly.h

+15-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@
2222
#include <sys/types.h>
2323
#include <string.h>
2424

25-
u_int64_t polymod (u_int64_t nh, u_int64_t nl, u_int64_t d);
26-
u_int64_t polygcd (u_int64_t x, u_int64_t y);
27-
void polymult (u_int64_t *php, u_int64_t *plp, u_int64_t x, u_int64_t y);
28-
u_int64_t polymmult (u_int64_t x, u_int64_t y, u_int64_t d);
29-
bool polyirreducible (u_int64_t f);
30-
u_int64_t polygen (u_int degree);
25+
uint64_t polymod (uint64_t nh, uint64_t nl, uint64_t d);
26+
uint64_t polygcd (uint64_t x, uint64_t y);
27+
void polymult (uint64_t *php, uint64_t *plp, uint64_t x, uint64_t y);
28+
uint64_t polymmult (uint64_t x, uint64_t y, uint64_t d);
29+
bool polyirreducible (uint64_t f);
3130

3231
class rabinpoly {
3332
int shift;
34-
u_int64_t T[256]; // Lookup table for mod
33+
uint64_t T[256]; // Lookup table for mod
3534
void calcT ();
3635
public:
37-
const u_int64_t poly; // Actual polynomial
36+
const uint64_t poly; // Actual polynomial
3837

39-
explicit rabinpoly (u_int64_t poly);
40-
u_int64_t append8 (u_int64_t p, u_char m) const
38+
explicit rabinpoly (uint64_t poly);
39+
uint64_t append8 (uint64_t p, uint8_t m) const
4140
{ return ((p << 8) | m) ^ T[p >> shift]; }
4241
};
4342

@@ -46,17 +45,17 @@ class window : public rabinpoly {
4645
enum {size = 48};
4746
//enum {size = 24};
4847
private:
49-
u_int64_t fingerprint;
48+
uint64_t fingerprint;
5049
int bufpos;
51-
u_int64_t U[256];
52-
u_char buf[size];
50+
uint64_t U[256];
51+
uint8_t buf[size];
5352

5453
public:
55-
window (u_int64_t poly);
56-
u_int64_t slide8 (u_char m) {
54+
window (uint64_t poly);
55+
uint64_t slide8 (uint8_t m) {
5756
if (++bufpos >= size)
5857
bufpos = 0;
59-
u_char om = buf[bufpos];
58+
uint8_t om = buf[bufpos];
6059
buf[bufpos] = m;
6160
return fingerprint = append8 (fingerprint ^ U[om], m);
6261
}

0 commit comments

Comments
 (0)