Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
f6293140
Commit
f6293140
authored
Jul 01, 2012
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make roughly work on signed integers.
This is needed for the stability aware code.
parent
ab6a6bd1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
util.c
util.c
+8
-3
util.h
util.h
+1
-1
No files found.
util.c
View file @
f6293140
...
@@ -36,9 +36,14 @@ THE SOFTWARE.
...
@@ -36,9 +36,14 @@ THE SOFTWARE.
#include "babeld.h"
#include "babeld.h"
#include "util.h"
#include "util.h"
unsigned
int
roughly
(
unsigned
value
)
roughly
(
int
value
)
{
{
if
(
value
<
0
)
return
-
roughly
(
-
value
);
else
if
(
value
<=
1
)
return
value
;
else
return
value
*
3
/
4
+
random
()
%
(
value
/
2
);
return
value
*
3
/
4
+
random
()
%
(
value
/
2
);
}
}
...
...
util.h
View file @
f6293140
...
@@ -66,7 +66,7 @@ seqno_plus(unsigned short s, int plus)
...
@@ -66,7 +66,7 @@ seqno_plus(unsigned short s, int plus)
return
((
s
+
plus
)
&
0xFFFF
);
return
((
s
+
plus
)
&
0xFFFF
);
}
}
unsigned
roughly
(
unsigned
value
);
int
roughly
(
int
value
);
void
timeval_minus
(
struct
timeval
*
d
,
void
timeval_minus
(
struct
timeval
*
d
,
const
struct
timeval
*
s1
,
const
struct
timeval
*
s2
);
const
struct
timeval
*
s1
,
const
struct
timeval
*
s2
);
unsigned
timeval_minus_msec
(
const
struct
timeval
*
s1
,
const
struct
timeval
*
s2
)
unsigned
timeval_minus_msec
(
const
struct
timeval
*
s1
,
const
struct
timeval
*
s2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment