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
4f4c5a01
Commit
4f4c5a01
authored
Jan 02, 2014
by
Kenton Varda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #61 from fahhem/master
Fix C+1y warnings from Clang.
parents
2602c0ec
33d57d1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
units.h
c++/src/kj/units.h
+12
-12
No files found.
c++/src/kj/units.h
View file @
4f4c5a01
...
...
@@ -54,12 +54,12 @@ struct Id {
inline
constexpr
Id
()
:
value
(
0
)
{}
inline
constexpr
explicit
Id
(
int
value
)
:
value
(
value
)
{}
inline
constexpr
bool
operator
==
(
const
Id
&
other
)
{
return
value
==
other
.
value
;
}
inline
constexpr
bool
operator
!=
(
const
Id
&
other
)
{
return
value
!=
other
.
value
;
}
inline
constexpr
bool
operator
<=
(
const
Id
&
other
)
{
return
value
<=
other
.
value
;
}
inline
constexpr
bool
operator
>=
(
const
Id
&
other
)
{
return
value
>=
other
.
value
;
}
inline
constexpr
bool
operator
<
(
const
Id
&
other
)
{
return
value
<
other
.
value
;
}
inline
constexpr
bool
operator
>
(
const
Id
&
other
)
{
return
value
>
other
.
value
;
}
inline
constexpr
bool
operator
==
(
const
Id
&
other
)
const
{
return
value
==
other
.
value
;
}
inline
constexpr
bool
operator
!=
(
const
Id
&
other
)
const
{
return
value
!=
other
.
value
;
}
inline
constexpr
bool
operator
<=
(
const
Id
&
other
)
const
{
return
value
<=
other
.
value
;
}
inline
constexpr
bool
operator
>=
(
const
Id
&
other
)
const
{
return
value
>=
other
.
value
;
}
inline
constexpr
bool
operator
<
(
const
Id
&
other
)
const
{
return
value
<
other
.
value
;
}
inline
constexpr
bool
operator
>
(
const
Id
&
other
)
const
{
return
value
>
other
.
value
;
}
};
// =======================================================================================
...
...
@@ -101,27 +101,27 @@ public:
template
<
typename
OtherNumber
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
+
OtherNumber
(
1
)),
Unit1
,
Unit2
>
operator
+
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit2
>
other
)
{
operator
+
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit2
>
other
)
const
{
return
UnitRatio
<
decltype
(
Number
(
1
)
+
OtherNumber
(
1
)),
Unit1
,
Unit2
>
(
unit1PerUnit2
+
other
.
unit1PerUnit2
);
}
template
<
typename
OtherNumber
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
-
OtherNumber
(
1
)),
Unit1
,
Unit2
>
operator
-
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit2
>
other
)
{
operator
-
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit2
>
other
)
const
{
return
UnitRatio
<
decltype
(
Number
(
1
)
-
OtherNumber
(
1
)),
Unit1
,
Unit2
>
(
unit1PerUnit2
-
other
.
unit1PerUnit2
);
}
template
<
typename
OtherNumber
,
typename
Unit3
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit3
,
Unit2
>
operator
*
(
UnitRatio
<
OtherNumber
,
Unit3
,
Unit1
>
other
)
{
operator
*
(
UnitRatio
<
OtherNumber
,
Unit3
,
Unit1
>
other
)
const
{
// U1 / U2 * U3 / U1 = U3 / U2
return
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit3
,
Unit2
>
(
unit1PerUnit2
*
other
.
unit1PerUnit2
);
}
template
<
typename
OtherNumber
,
typename
Unit3
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit1
,
Unit3
>
operator
*
(
UnitRatio
<
OtherNumber
,
Unit2
,
Unit3
>
other
)
{
operator
*
(
UnitRatio
<
OtherNumber
,
Unit2
,
Unit3
>
other
)
const
{
// U1 / U2 * U2 / U3 = U1 / U3
return
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit1
,
Unit3
>
(
unit1PerUnit2
*
other
.
unit1PerUnit2
);
...
...
@@ -129,14 +129,14 @@ public:
template
<
typename
OtherNumber
,
typename
Unit3
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit3
,
Unit2
>
operator
/
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit3
>
other
)
{
operator
/
(
UnitRatio
<
OtherNumber
,
Unit1
,
Unit3
>
other
)
const
{
// (U1 / U2) / (U1 / U3) = U3 / U2
return
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit3
,
Unit2
>
(
unit1PerUnit2
/
other
.
unit1PerUnit2
);
}
template
<
typename
OtherNumber
,
typename
Unit3
>
inline
constexpr
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit1
,
Unit3
>
operator
/
(
UnitRatio
<
OtherNumber
,
Unit3
,
Unit2
>
other
)
{
operator
/
(
UnitRatio
<
OtherNumber
,
Unit3
,
Unit2
>
other
)
const
{
// (U1 / U2) / (U3 / U2) = U1 / U3
return
UnitRatio
<
decltype
(
Number
(
1
)
*
OtherNumber
(
1
)),
Unit1
,
Unit3
>
(
unit1PerUnit2
/
other
.
unit1PerUnit2
);
...
...
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