Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unsigned long long cast operator #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/FSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class FSize :
* - 1.66 - returns just the lower bits
**/
explicit operator long long() const { return static_cast<long long>(_size); }
explicit operator unsigned long long() const { return static_cast<unsigned long long>(_size); }
explicit operator int() const { return static_cast<int>(_size); }
explicit operator double() const { return static_cast<double>(_size); }

Expand Down
4 changes: 2 additions & 2 deletions tests/FSize_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ BOOST_AUTO_TEST_CASE( comparing_with_limits )
FSize fsize(cpp_int(1) << 1024);

// even bigger than the max long long
BOOST_CHECK(fsize > std::numeric_limits<long long>::max());
BOOST_CHECK((long long)fsize > std::numeric_limits<long long>::max());
// even bigger than the max unsigned long long
BOOST_CHECK(fsize > std::numeric_limits<unsigned long long>::max());
BOOST_CHECK((unsigned long long)fsize > std::numeric_limits<unsigned long long>::max());
// even bigger than the max double
BOOST_CHECK(fsize > std::numeric_limits<double>::max());

Expand Down