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
041401ba
Commit
041401ba
authored
Mar 30, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on GCC.
parent
f215c5f0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
25 deletions
+10
-25
layout.c++
c++/src/capnp/layout.c++
+4
-4
units.h
c++/src/kj/units.h
+6
-21
No files found.
c++/src/capnp/layout.c++
View file @
041401ba
...
...
@@ -367,7 +367,7 @@ struct WireHelpers {
}
template
<
typename
T
>
static
KJ_ALWAYS_INLINE
(
void
zeroMemory
(
kj
::
ArrayPtr
<
T
>
array
)
)
{
static
inline
void
zeroMemory
(
kj
::
ArrayPtr
<
T
>
array
)
{
memset
(
array
.
begin
(),
0
,
array
.
size
()
*
sizeof
(
array
[
0
]));
}
...
...
@@ -385,17 +385,17 @@ struct WireHelpers {
}
template
<
typename
T
>
static
KJ_ALWAYS_INLINE
(
void
copyMemory
(
T
*
to
,
const
T
*
from
)
)
{
static
inline
void
copyMemory
(
T
*
to
,
const
T
*
from
)
{
memcpy
(
to
,
from
,
sizeof
(
*
from
));
}
// TODO(cleanup): Turn these into a .copyTo() method of ArrayPtr?
template
<
typename
T
>
static
KJ_ALWAYS_INLINE
(
void
copyMemory
(
T
*
to
,
kj
::
ArrayPtr
<
T
>
from
)
)
{
static
inline
void
copyMemory
(
T
*
to
,
kj
::
ArrayPtr
<
T
>
from
)
{
memcpy
(
to
,
from
.
begin
(),
from
.
size
()
*
sizeof
(
from
[
0
]));
}
template
<
typename
T
>
static
KJ_ALWAYS_INLINE
(
void
copyMemory
(
T
*
to
,
kj
::
ArrayPtr
<
const
T
>
from
)
)
{
static
inline
void
copyMemory
(
T
*
to
,
kj
::
ArrayPtr
<
const
T
>
from
)
{
memcpy
(
to
,
from
.
begin
(),
from
.
size
()
*
sizeof
(
from
[
0
]));
}
static
KJ_ALWAYS_INLINE
(
void
copyMemory
(
char
*
to
,
kj
::
StringPtr
from
))
{
...
...
c++/src/kj/units.h
View file @
041401ba
...
...
@@ -724,21 +724,6 @@ private:
template
<
uint64_t
,
typename
>
friend
class
Bounded
;
template
<
uint64_t
aN
,
uint64_t
bN
,
typename
A
,
typename
B
>
friend
constexpr
Bounded
<
kj
::
min
(
aN
,
bN
),
WiderType
<
A
,
B
>>
min
(
Bounded
<
aN
,
A
>
a
,
Bounded
<
bN
,
B
>
b
);
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
friend
constexpr
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
min
(
Bounded
<
aN
,
A
>
a
,
BoundedConst
<
b
>
);
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
friend
constexpr
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
min
(
BoundedConst
<
b
>
,
Bounded
<
aN
,
A
>
a
);
template
<
uint64_t
aN
,
uint64_t
bN
,
typename
A
,
typename
B
>
friend
constexpr
Bounded
<
kj
::
max
(
aN
,
bN
),
WiderType
<
A
,
B
>>
max
(
Bounded
<
aN
,
A
>
a
,
Bounded
<
bN
,
B
>
b
);
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
friend
constexpr
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
max
(
Bounded
<
aN
,
A
>
a
,
BoundedConst
<
b
>
);
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
friend
constexpr
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
max
(
BoundedConst
<
b
>
,
Bounded
<
aN
,
A
>
a
);
};
template
<
typename
Number
>
...
...
@@ -893,12 +878,12 @@ inline auto trySubtract(Quantity<T, Unit> value, Quantity<U, Unit> other)
template
<
uint64_t
aN
,
uint64_t
bN
,
typename
A
,
typename
B
>
inline
constexpr
Bounded
<
kj
::
min
(
aN
,
bN
),
WiderType
<
A
,
B
>>
min
(
Bounded
<
aN
,
A
>
a
,
Bounded
<
bN
,
B
>
b
)
{
return
Bounded
<
kj
::
min
(
aN
,
bN
),
WiderType
<
A
,
B
>>
(
kj
::
min
(
a
.
value
,
b
.
value
),
unsafe
);
return
Bounded
<
kj
::
min
(
aN
,
bN
),
WiderType
<
A
,
B
>>
(
kj
::
min
(
a
.
unwrap
(),
b
.
unwrap
()
),
unsafe
);
}
template
<
uint64_t
aN
,
uint64_t
bN
,
typename
A
,
typename
B
>
inline
constexpr
Bounded
<
kj
::
max
(
aN
,
bN
),
WiderType
<
A
,
B
>>
max
(
Bounded
<
aN
,
A
>
a
,
Bounded
<
bN
,
B
>
b
)
{
return
Bounded
<
kj
::
max
(
aN
,
bN
),
WiderType
<
A
,
B
>>
(
kj
::
max
(
a
.
value
,
b
.
value
),
unsafe
);
return
Bounded
<
kj
::
max
(
aN
,
bN
),
WiderType
<
A
,
B
>>
(
kj
::
max
(
a
.
unwrap
(),
b
.
unwrap
()
),
unsafe
);
}
// We need to override min() and max() because:
// 1) WiderType<> might not choose the correct bounds.
...
...
@@ -982,19 +967,19 @@ inline constexpr Bounded<cvalue, decltype(uint() - T())>
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
inline
constexpr
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
min
(
Bounded
<
aN
,
A
>
a
,
BoundedConst
<
b
>
)
{
return
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
(
kj
::
min
(
b
,
a
.
value
),
unsafe
);
return
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
(
kj
::
min
(
b
,
a
.
unwrap
()
),
unsafe
);
}
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
inline
constexpr
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
min
(
BoundedConst
<
b
>
,
Bounded
<
aN
,
A
>
a
)
{
return
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
(
kj
::
min
(
a
.
value
,
b
),
unsafe
);
return
Bounded
<
kj
::
min
(
aN
,
b
),
A
>
(
kj
::
min
(
a
.
unwrap
()
,
b
),
unsafe
);
}
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
inline
constexpr
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
max
(
Bounded
<
aN
,
A
>
a
,
BoundedConst
<
b
>
)
{
return
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
(
kj
::
max
(
b
,
a
.
value
),
unsafe
);
return
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
(
kj
::
max
(
b
,
a
.
unwrap
()
),
unsafe
);
}
template
<
uint64_t
aN
,
uint
b
,
typename
A
>
inline
constexpr
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
max
(
BoundedConst
<
b
>
,
Bounded
<
aN
,
A
>
a
)
{
return
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
(
kj
::
max
(
a
.
value
,
b
),
unsafe
);
return
Bounded
<
kj
::
max
(
aN
,
b
),
A
>
(
kj
::
max
(
a
.
unwrap
()
,
b
),
unsafe
);
}
// We need to override min() between a Bounded and a constant since:
// 1) WiderType<> might choose BoundedConst over a 1-byte Bounded, which is wrong.
...
...
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