Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
bd2452c9
Commit
bd2452c9
authored
Dec 21, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conversion warnings
parent
74812501
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
libcaf_core/caf/detail/ieee_754.hpp
libcaf_core/caf/detail/ieee_754.hpp
+7
-8
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+6
-4
libcaf_core/src/ripemd_160.cpp
libcaf_core/src/ripemd_160.cpp
+10
-8
No files found.
libcaf_core/caf/detail/ieee_754.hpp
View file @
bd2452c9
...
...
@@ -92,14 +92,14 @@ typename ieee_754_trait<T>::packed_type pack754(T f) {
}
fnorm
=
fnorm
-
static_cast
<
T
>
(
1
);
// calculate 2^significandbits
auto
pownum
=
static_cast
<
result_type
>
(
1
)
<<
significandbits
;
auto
pownum
=
static_cast
<
T
>
(
result_type
{
1
}
<<
significandbits
)
;
// calculate the binary form (non-float) of the significand data
auto
significand
=
static_cast
<
result_type
>
(
fnorm
*
(
pownum
+
trait
::
p5
));
// get the biased exponent
auto
exp
=
shift
+
((
1
<<
(
trait
::
expbits
-
1
))
-
1
);
// shift + bias
// return the final answer
return
(
sign
<<
(
trait
::
bits
-
1
))
|
(
exp
<<
(
trait
::
bits
-
trait
::
expbits
-
1
))
|
significand
;
return
(
sign
<<
(
trait
::
bits
-
1
))
|
(
exp
<<
(
trait
::
bits
-
trait
::
expbits
-
1
))
|
significand
;
}
template
<
class
T
>
...
...
@@ -109,11 +109,10 @@ typename ieee_754_trait<T>::float_type unpack754(T i) {
using
result_type
=
typename
trait
::
float_type
;
if
(
i
==
0
)
return
trait
::
zero
;
auto
significandbits
=
trait
::
bits
-
trait
::
expbits
-
1
;
// -1 for sign bit
// pull the significand
result_type
result
=
(
i
&
((
static_cast
<
T
>
(
1
)
<<
significandbits
)
-
1
));
// mask
result
/=
(
static_cast
<
T
>
(
1
)
<<
significandbits
);
// convert back to float
result
+=
static_cast
<
result_type
>
(
1
);
// add the one back on
// pull the significand: mask, convert back to float + add the one back on
auto
result
=
static_cast
<
result_type
>
(
i
&
((
T
{
1
}
<<
significandbits
)
-
1
));
result
/=
static_cast
<
result_type
>
(
T
{
1
}
<<
significandbits
);
result
+=
static_cast
<
result_type
>
(
1
);
// deal with the exponent
auto
si
=
static_cast
<
signed_type
>
(
i
);
auto
bias
=
(
1
<<
(
trait
::
expbits
-
1
))
-
1
;
...
...
libcaf_core/src/node_id.cpp
View file @
bd2452c9
...
...
@@ -68,8 +68,9 @@ void host_id_from_string(const std::string& hash,
for
(
size_t
i
=
0
;
i
<
node_id
.
size
();
++
i
)
{
// read two characters, each representing 4 bytes
auto
&
val
=
node_id
[
i
];
val
=
static_cast
<
uint8_t
>
(
hex_char_value
(
*
j
++
)
<<
4
);
val
|=
hex_char_value
(
*
j
++
);
val
=
static_cast
<
uint8_t
>
(
hex_char_value
(
j
[
0
])
<<
4
)
|
hex_char_value
(
j
[
1
]);
j
+=
2
;
}
}
...
...
@@ -84,8 +85,9 @@ bool equal(const std::string& hash, const node_id::host_id_type& node_id) {
for
(
size_t
i
=
0
;
i
<
node_id
.
size
();
++
i
)
{
// read two characters, each representing 4 bytes
uint8_t
val
;
val
=
static_cast
<
uint8_t
>
(
hex_char_value
(
*
j
++
)
<<
4
);
val
|=
hex_char_value
(
*
j
++
);
val
=
static_cast
<
uint8_t
>
(
hex_char_value
(
j
[
0
])
<<
4
)
|
hex_char_value
(
j
[
1
]);
j
+=
2
;
if
(
val
!=
node_id
[
i
])
{
return
false
;
}
...
...
libcaf_core/src/ripemd_160.cpp
View file @
bd2452c9
...
...
@@ -65,6 +65,8 @@ namespace {
using
byte
=
unsigned
char
;
using
dword
=
uint32_t
;
static_assert
(
sizeof
(
dword
)
==
sizeof
(
unsigned
),
"platform not supported"
);
// macro definitions
// collect four bytes into one word:
...
...
@@ -95,28 +97,28 @@ using dword = uint32_t;
#define GG(a, b, c, d, e, x, s) \
{ \
(a) += G((b), (c), (d)) + (x) + 0x5a827999U
L;
\
(a) += G((b), (c), (d)) + (x) + 0x5a827999U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define HH(a, b, c, d, e, x, s) \
{ \
(a) += H((b), (c), (d)) + (x) + 0x6ed9eba1U
L;
\
(a) += H((b), (c), (d)) + (x) + 0x6ed9eba1U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define II(a, b, c, d, e, x, s) \
{ \
(a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcU
L;
\
(a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcU
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define JJ(a, b, c, d, e, x, s) \
{ \
(a) += J((b), (c), (d)) + (x) + 0xa953fd4eU
L;
\
(a) += J((b), (c), (d)) + (x) + 0xa953fd4eU
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
...
...
@@ -130,28 +132,28 @@ using dword = uint32_t;
#define GGG(a, b, c, d, e, x, s) \
{ \
(a) += G((b), (c), (d)) + (x) + 0x7a6d76e9U
L;
\
(a) += G((b), (c), (d)) + (x) + 0x7a6d76e9U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define HHH(a, b, c, d, e, x, s) \
{ \
(a) += H((b), (c), (d)) + (x) + 0x6d703ef3U
L;
\
(a) += H((b), (c), (d)) + (x) + 0x6d703ef3U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define III(a, b, c, d, e, x, s) \
{ \
(a) += I((b), (c), (d)) + (x) + 0x5c4dd124U
L;
\
(a) += I((b), (c), (d)) + (x) + 0x5c4dd124U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
#define JJJ(a, b, c, d, e, x, s) \
{ \
(a) += J((b), (c), (d)) + (x) + 0x50a28be6U
L;
\
(a) += J((b), (c), (d)) + (x) + 0x50a28be6U
;
\
(a) = ROL((a), (s)) + (e); \
(c) = ROL((c), 10); \
}
...
...
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