Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
3843340c
Commit
3843340c
authored
May 08, 2016
by
Dong-hee Na
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitset micro-optimize
parent
cb0fd07e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
src/core/util.h
src/core/util.h
+6
-7
No files found.
src/core/util.h
View file @
3843340c
...
...
@@ -153,19 +153,18 @@ template <int N> struct BitSet {
bool
operator
==
(
const
iterator
&
rhs
)
{
return
cur
==
rhs
.
cur
;
}
bool
operator
!=
(
const
iterator
&
rhs
)
{
return
!
(
*
this
==
rhs
);
}
iterator
&
operator
++
()
{
// TODO: this function (and begin()) could be optimized using __builtin_ctz
assert
(
cur
>=
0
&&
cur
<
N
);
uint16_t
tmp
=
set
.
bits
;
tmp
>>=
cur
+
1
;
cur
++
;
while
(
cur
<
N
)
{
if
(
tmp
&
1
)
if
(
tmp
>
0
)
{
int
offset
=
__builtin_ctz
(
tmp
);
if
(
cur
+
offset
<
N
)
{
cur
+=
offset
;
return
*
this
;
cur
++
;
tmp
>>=
1
;
}
}
cur
=
N
;
assert
(
cur
==
N
);
return
*
this
;
}
...
...
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