Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
b299dcd7
Commit
b299dcd7
authored
Jun 10, 2018
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement lg() for MSVC.
parent
209b82d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
table.c++
c++/src/kj/table.c++
+9
-0
No files found.
c++/src/kj/table.c++
View file @
b299dcd7
...
...
@@ -28,7 +28,16 @@ namespace _ {
static
inline
uint
lg
(
uint
value
)
{
// Compute floor(log2(value)).
//
// Undefined for value = 0.
#if _MSC_VER
unsigned
long
i
;
auto
found
=
_BitScanReverse
(
&
i
,
value
);
KJ_DASSERT
(
found
);
// !found means value = 0
return
i
;
#else
return
sizeof
(
uint
)
*
8
-
1
-
__builtin_clz
(
value
);
#endif
}
void
throwDuplicateTableRow
()
{
...
...
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