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
0d78bd12
Commit
0d78bd12
authored
Sep 20, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings on 32-bit GCC
parent
8df860e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
8 deletions
+44
-8
libcaf_core/caf/streambuf.hpp
libcaf_core/caf/streambuf.hpp
+44
-8
No files found.
libcaf_core/caf/streambuf.hpp
View file @
0d78bd12
...
...
@@ -44,35 +44,71 @@ protected:
/// architectures. All stream buffer implementations should therefore use
/// these function instead. For a detailed discussion, see:
/// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47921
template
<
class
T
>
detail
::
enable_if_t
<
std
::
is_signed
<
T
>::
value
&&
(
sizeof
(
T
)
>
sizeof
(
int
))
>
safe_pbump
(
T
n
)
{
auto
max_int
=
static_cast
<
T
>
(
std
::
numeric_limits
<
int
>::
max
());
while
(
n
>
max_int
)
{
this
->
pbump
(
std
::
numeric_limits
<
int
>::
max
());
n
-=
max_int
;
}
this
->
pbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
=
int
>
typename
std
::
enable_if
<
sizeof
(
T
)
==
4
>::
type
detail
::
enable_if_t
<
std
::
is_signed
<
T
>::
value
&&
(
sizeof
(
T
)
<=
sizeof
(
int
))
>
safe_pbump
(
std
::
streamsize
n
)
{
while
(
n
>
std
::
numeric_limits
<
int
>::
max
())
{
this
->
pbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
>
detail
::
enable_if_t
<
std
::
is_unsigned
<
T
>::
value
&&
(
sizeof
(
T
)
>=
sizeof
(
int
))
>
safe_pbump
(
T
n
)
{
auto
max_int
=
static_cast
<
T
>
(
std
::
numeric_limits
<
int
>::
max
());
while
(
n
>
max_int
)
{
this
->
pbump
(
std
::
numeric_limits
<
int
>::
max
());
n
-=
std
::
numeric_limits
<
int
>::
max
()
;
n
-=
max_int
;
}
this
->
pbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
=
int
>
typename
std
::
enable_if
<
sizeof
(
T
)
==
8
>::
type
detail
::
enable_if_t
<
std
::
is_unsigned
<
T
>::
value
&&
(
sizeof
(
T
)
<
sizeof
(
int
))
>
safe_pbump
(
std
::
streamsize
n
)
{
this
->
pbump
(
static_cast
<
int
>
(
n
));
}
// As above, but for the get area.
template
<
class
T
>
detail
::
enable_if_t
<
std
::
is_signed
<
T
>::
value
&&
(
sizeof
(
T
)
>
sizeof
(
int
))
>
safe_gbump
(
T
n
)
{
auto
max_int
=
static_cast
<
T
>
(
std
::
numeric_limits
<
int
>::
max
());
while
(
n
>
max_int
)
{
this
->
gbump
(
std
::
numeric_limits
<
int
>::
max
());
n
-=
max_int
;
}
this
->
gbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
=
int
>
typename
std
::
enable_if
<
sizeof
(
T
)
==
4
>::
type
detail
::
enable_if_t
<
std
::
is_signed
<
T
>::
value
&&
(
sizeof
(
T
)
<=
sizeof
(
int
))
>
safe_gbump
(
std
::
streamsize
n
)
{
while
(
n
>
std
::
numeric_limits
<
int
>::
max
())
{
this
->
gbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
>
detail
::
enable_if_t
<
std
::
is_unsigned
<
T
>::
value
&&
(
sizeof
(
T
)
>=
sizeof
(
int
))
>
safe_gbump
(
T
n
)
{
auto
max_int
=
static_cast
<
T
>
(
std
::
numeric_limits
<
int
>::
max
());
while
(
n
>
max_int
)
{
this
->
gbump
(
std
::
numeric_limits
<
int
>::
max
());
n
-=
std
::
numeric_limits
<
int
>::
max
()
;
n
-=
max_int
;
}
this
->
gbump
(
static_cast
<
int
>
(
n
));
}
template
<
class
T
=
int
>
typename
std
::
enable_if
<
sizeof
(
T
)
==
8
>::
type
detail
::
enable_if_t
<
std
::
is_unsigned
<
T
>::
value
&&
(
sizeof
(
T
)
<
sizeof
(
int
))
>
safe_gbump
(
std
::
streamsize
n
)
{
this
->
gbump
(
static_cast
<
int
>
(
n
));
}
...
...
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