fix: CodeQL warnings

This commit is contained in:
2kindsofcs 2021-10-31 13:23:09 +09:00
parent 4e3abd4601
commit f1c33253c7
3 changed files with 5 additions and 2 deletions

View File

@ -462,7 +462,7 @@ class uint128_t {
tmp <<= left; tmp <<= left;
uint128_t quotient(0); uint128_t quotient(0);
uint128_t zero(0); uint128_t zero(0);
while (left >= 0 && tmp2 >= p) { while (tmp2 >= p) {
uint16_t shf = tmp2._lez() - tmp._lez(); uint16_t shf = tmp2._lez() - tmp._lez();
if (shf) { if (shf) {
tmp >>= shf; tmp >>= shf;

View File

@ -429,7 +429,7 @@ class uint256_t {
tmp <<= left; tmp <<= left;
uint256_t quotient(0); uint256_t quotient(0);
uint256_t zero(0); uint256_t zero(0);
while (left >= 0 && tmp2 >= p) { while (tmp2 >= p) {
uint16_t shf = tmp2._lez() - tmp._lez(); uint16_t shf = tmp2._lez() - tmp._lez();
if (shf) { if (shf) {
tmp >>= shf; tmp >>= shf;

View File

@ -128,6 +128,7 @@ int32_t list::top() {
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cerr << "List is empty" << e.what() << '\n'; std::cerr << "List is empty" << e.what() << '\n';
} }
return 0;
} }
/** /**
* @brief Utility function to find the last element of the list * @brief Utility function to find the last element of the list
@ -145,6 +146,7 @@ int32_t list::last() {
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cerr << "List is empty" << e.what() << '\n'; std::cerr << "List is empty" << e.what() << '\n';
} }
return 0;
} }
/** /**
* @brief Utility function to find the i th element of the list * @brief Utility function to find the i th element of the list
@ -165,6 +167,7 @@ int32_t list::traverse(int index) {
/* if we get to this line,the caller was asking for a non-existent element /* if we get to this line,the caller was asking for a non-existent element
so we assert fail */ so we assert fail */
assert(0); assert(0);
return 0;
} }
} // namespace linked_list } // namespace linked_list