/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expected<Tgt, ConversionCode>>::type
convertTo(const Src& value) noexcept {
/* static */ if (
- std::numeric_limits<Tgt>::max() < std::numeric_limits<Src>::max()) {
+ folly::_t<std::make_unsigned<Tgt>>(std::numeric_limits<Tgt>::max()) <
+ folly::_t<std::make_unsigned<Src>>(std::numeric_limits<Src>::max())) {
if (greater_than<Tgt, std::numeric_limits<Tgt>::max()>(value)) {
return makeUnexpected(ConversionCode::ARITH_POSITIVE_OVERFLOW);
}
return makeUnexpected(ConversionCode::ARITH_NEGATIVE_OVERFLOW);
}
}
- return boost::implicit_cast<Tgt>(value);
+ return static_cast<Tgt>(value);
}
/**