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
9f6b430b
Commit
9f6b430b
authored
Jun 04, 2015
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify prefix_cmp.
parent
6d99bd57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
util.c
util.c
+10
-13
No files found.
util.c
View file @
9f6b430b
...
...
@@ -494,25 +494,22 @@ enum prefix_status
prefix_cmp
(
const
unsigned
char
*
p1
,
unsigned
char
plen1
,
const
unsigned
char
*
p2
,
unsigned
char
plen2
)
{
int
min
=
MIN
(
plen1
,
plen2
);
unsigned
char
mask
=
0xFF
;
int
i
=
0
;
int
plen
=
MIN
(
plen1
,
plen2
);
while
(
i
<
min
/
8
)
{
if
(
p1
[
i
]
!=
p2
[
i
])
return
PST_DISJOINT
;
i
++
;
}
min
-=
i
*
8
;
if
(
min
!=
0
)
{
mask
<<=
8
-
min
;
if
(
memcmp
(
p1
,
p2
,
plen
/
8
)
!=
0
)
return
PST_DISJOINT
;
if
(
plen
%
8
!=
0
)
{
int
i
=
plen
/
8
+
1
;
unsigned
char
mask
=
(
0xFF
<<
(
plen
%
8
))
&
0xFF
;
if
((
p1
[
i
]
&
mask
)
!=
(
p2
[
i
]
&
mask
))
return
PST_DISJOINT
;
}
if
(
plen1
<
plen2
)
return
PST_LESS_SPECIFIC
;
if
(
plen1
>
plen2
)
else
if
(
plen1
>
plen2
)
return
PST_MORE_SPECIFIC
;
return
PST_EQUALS
;
else
return
PST_EQUALS
;
}
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