Repository navigation
Fix remaining cpplint issues: C-style casts and missing includes - #475
Conversation
| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: no header providing "uint16_t" is directly included [misc-include-cleaner]
keyvi/include/keyvi/compression/predictive_compression.h:29:
- #include <cstdio>
+ #include <cstdint>
+ #include <cstdio>| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
return predictor_table_[(static_cast<uint16_t>(bigram[0]) << 8) + bigram[1]];
^| instream.get(c); | ||
| if (instream.eof()) break; | ||
| uint16_t index = (uint16_t(c) << 8) + (uint16_t)instream.get(); | ||
| uint16_t index = (static_cast<uint16_t>(c) << 8) + static_cast<uint16_t>(instream.get()); |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
uint16_t index = (static_cast<uint16_t>(c) << 8) + static_cast<uint16_t>(instream.get());
^| instream.get(c); | ||
| if (instream.eof()) break; | ||
| uint16_t index = (uint16_t(c) << 8) + (uint16_t)instream.get(); | ||
| uint16_t index = (static_cast<uint16_t>(c) << 8) + static_cast<uint16_t>(instream.get()); |
There was a problem hiding this comment.
warning: variable 'index' of type 'uint16_t' (aka 'unsigned short') can be declared 'const' [misc-const-correctness]
| uint16_t index = (static_cast<uint16_t>(c) << 8) + static_cast<uint16_t>(instream.get()); | |
| uint16_t const index = (static_cast<uint16_t>(c) << 8) + static_cast<uint16_t>(instream.get()); |
| #include <array> | ||
| #include <limits> | ||
| #include <utility> | ||
|
|
There was a problem hiding this comment.
warning: included header utility is not used directly [misc-include-cleaner]
| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } |
There was a problem hiding this comment.
warning: function 'Set' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
| inline void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } | |
| void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } |
| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } |
There was a problem hiding this comment.
warning: no header providing "size_t" is directly included [misc-include-cleaner]
inline void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); }
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]]; |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8) + bigram[1]];
^| instream.get(c); | ||
| if (instream.eof()) break; | ||
| uint16_t index = (uint16_t(c) << 8) + (uint16_t)instream.get(); | ||
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFu) << 8) + instream.get(); |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFu) << 8) + instream.get(); | |
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFU) << 8) + instream.get(); |
| instream.get(c); | ||
| if (instream.eof()) break; | ||
| uint16_t index = (uint16_t(c) << 8) + (uint16_t)instream.get(); | ||
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFu) << 8) + instream.get(); |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
const uint16_t index = ((static_cast<unsigned>(c) & 0xFFu) << 8) + instream.get();
^| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); }
^| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); } |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
void Set(const size_t bit) { bits_[bit >> 6] |= static_cast<uint64_t>(1) << (bit & 63); }
^| * @param bit the bit to erase. | ||
| */ | ||
| inline void Erase(const size_t bit) { bits_[bit >> 6] &= (uint64_t)(~(1 << (bit & 63))); } | ||
| void Erase(const size_t bit) { bits_[bit >> 6] &= static_cast<uint64_t>(~(1ULL << (bit & 63))); } |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
void Erase(const size_t bit) { bits_[bit >> 6] &= static_cast<uint64_t>(~(1ULL << (bit & 63))); }
^| * @param bit the bit to erase. | ||
| */ | ||
| inline void Erase(const size_t bit) { bits_[bit >> 6] &= (uint64_t)(~(1 << (bit & 63))); } | ||
| void Erase(const size_t bit) { bits_[bit >> 6] &= static_cast<uint64_t>(~(1ULL << (bit & 63))); } |
There was a problem hiding this comment.
warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
void Erase(const size_t bit) { bits_[bit >> 6] &= static_cast<uint64_t>(~(1ULL << (bit & 63))); }
^7a43caf to
b0744bb
Compare
| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]]; |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8u) + bigram[1]]; | |
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]]; |
| instream.get(c); | ||
| if (instream.eof()) break; | ||
| uint16_t index = (uint16_t(c) << 8) + (uint16_t)instream.get(); | ||
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFU) << 8u) + instream.get(); |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFU) << 8u) + instream.get(); | |
| const uint16_t index = ((static_cast<unsigned>(c) & 0xFFU) << 8U) + instream.get(); |
| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| void Set(const size_t bit) { bits_[bit >> 6u] |= static_cast<uint64_t>(1) << (bit & 63u); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| void Set(const size_t bit) { bits_[bit >> 6u] |= static_cast<uint64_t>(1) << (bit & 63u); } | |
| void Set(const size_t bit) { bits_[bit >> 6U] |= static_cast<uint64_t>(1) << (bit & 63u); } |
| * @param bit the bit to set. | ||
| */ | ||
| inline void Set(const size_t bit) { bits_[bit >> 6] |= (uint64_t)1 << (bit & 63); } | ||
| void Set(const size_t bit) { bits_[bit >> 6u] |= static_cast<uint64_t>(1) << (bit & 63u); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| void Set(const size_t bit) { bits_[bit >> 6u] |= static_cast<uint64_t>(1) << (bit & 63u); } | |
| void Set(const size_t bit) { bits_[bit >> 6u] |= static_cast<uint64_t>(1) << (bit & 63U); } |
| * @param bit the bit to erase. | ||
| */ | ||
| inline void Erase(const size_t bit) { bits_[bit >> 6] &= (uint64_t)(~(1 << (bit & 63))); } | ||
| void Erase(const size_t bit) { bits_[bit >> 6u] &= static_cast<uint64_t>(~(1ULL << (bit & 63u))); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| void Erase(const size_t bit) { bits_[bit >> 6u] &= static_cast<uint64_t>(~(1ULL << (bit & 63u))); } | |
| void Erase(const size_t bit) { bits_[bit >> 6U] &= static_cast<uint64_t>(~(1ULL << (bit & 63u))); } |
| * @param bit the bit to erase. | ||
| */ | ||
| inline void Erase(const size_t bit) { bits_[bit >> 6] &= (uint64_t)(~(1 << (bit & 63))); } | ||
| void Erase(const size_t bit) { bits_[bit >> 6u] &= static_cast<uint64_t>(~(1ULL << (bit & 63u))); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| void Erase(const size_t bit) { bits_[bit >> 6u] &= static_cast<uint64_t>(~(1ULL << (bit & 63u))); } | |
| void Erase(const size_t bit) { bits_[bit >> 6u] &= static_cast<uint64_t>(~(1ULL << (bit & 63U))); } |
| */ | ||
| inline bool Get(const size_t bit) const { return (bits_[bit >> 6] & ((uint64_t)1 << (bit & 63))) != 0; } | ||
| [[nodiscard]] bool Get(const size_t bit) const { | ||
| return (bits_[bit >> 6u] & (static_cast<uint64_t>(1) << (bit & 63u))) != 0; |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| return (bits_[bit >> 6u] & (static_cast<uint64_t>(1) << (bit & 63u))) != 0; | |
| return (bits_[bit >> 6U] & (static_cast<uint64_t>(1) << (bit & 63u))) != 0; |
| */ | ||
| inline bool Get(const size_t bit) const { return (bits_[bit >> 6] & ((uint64_t)1 << (bit & 63))) != 0; } | ||
| [[nodiscard]] bool Get(const size_t bit) const { | ||
| return (bits_[bit >> 6u] & (static_cast<uint64_t>(1) << (bit & 63u))) != 0; |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| return (bits_[bit >> 6u] & (static_cast<uint64_t>(1) << (bit & 63u))) != 0; | |
| return (bits_[bit >> 6u] & (static_cast<uint64_t>(1) << (bit & 63U))) != 0; |
| PackedState() : PackedState(0, 0, 0) {} | ||
| PackedState(OffsetTypeT offset, HashCodeTypeT hashcode, int num_outgoing) | ||
| : offset_(offset), hashcode_(hashcode), num_outgoing_and_cookie_((uint32_t)(num_outgoing & 0x1FF)) {} | ||
| : offset_(offset), hashcode_(hashcode), num_outgoing_and_cookie_(static_cast<uint32_t>(num_outgoing) & 0x1FFu) {} |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| : offset_(offset), hashcode_(hashcode), num_outgoing_and_cookie_(static_cast<uint32_t>(num_outgoing) & 0x1FFu) {} | |
| : offset_(offset), hashcode_(hashcode), num_outgoing_and_cookie_(static_cast<uint32_t>(num_outgoing) & 0x1FFU) {} |
| HashCodeTypeT GetHashcode() const { return hashcode_; } | ||
|
|
||
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FF); } | ||
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } |
There was a problem hiding this comment.
warning: function 'GetNumberOfOutgoingTransitions' should be marked [[nodiscard]] [modernize-use-nodiscard]
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } | |
| [[nodiscard]] int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } |
| HashCodeTypeT GetHashcode() const { return hashcode_; } | ||
|
|
||
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FF); } | ||
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } | |
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFU); } |
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } | ||
|
|
||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00) >> 9); } | ||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } |
There was a problem hiding this comment.
warning: function 'GetCookie' should be marked [[nodiscard]] [modernize-use-nodiscard]
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } | |
| [[nodiscard]] int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } |
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } | ||
|
|
||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00) >> 9); } | ||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } | |
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00U) >> 9u); } |
| int GetNumberOfOutgoingTransitions() const { return static_cast<int>(this->num_outgoing_and_cookie_ & 0x1FFu); } | ||
|
|
||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00) >> 9); } | ||
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9u); } | |
| int GetCookie() const { return static_cast<int>((this->num_outgoing_and_cookie_ & 0xFFFFFE00u) >> 9U); } |
|
|
||
| void SetCookie(int value) { | ||
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FF) | (uint32_t)(value << 9); | ||
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFu) | (static_cast<uint32_t>(value) << 9u); |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFu) | (static_cast<uint32_t>(value) << 9u); | |
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFU) | (static_cast<uint32_t>(value) << 9u); |
|
|
||
| void SetCookie(int value) { | ||
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FF) | (uint32_t)(value << 9); | ||
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFu) | (static_cast<uint32_t>(value) << 9u); |
There was a problem hiding this comment.
warning: integer literal has suffix 'u', which is not uppercase [hicpp-uppercase-literal-suffix]
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFu) | (static_cast<uint32_t>(value) << 9u); | |
| this->num_outgoing_and_cookie_ = (this->num_outgoing_and_cookie_ & 0x1FFu) | (static_cast<uint32_t>(value) << 9U); |
| #define KEYVI_DICTIONARY_FSA_INTERNAL_SPARSE_ARRAY_BUILDER_H_ | ||
|
|
||
| #include <iostream> // NOLINT(misc-include-cleaner) | ||
|
|
There was a problem hiding this comment.
warning: included header iostream is not used directly [misc-include-cleaner]
b0744bb to
32447e5
Compare
| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use array subscript when the index is not an integer constant expression [cppcoreguidelines-pro-bounds-constant-array-index]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]];
^| return ""; | ||
| } else { | ||
| return predictor_table_[(uint16_t(bigram[0]) << 8) + bigram[1]]; | ||
| return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
return predictor_table_[(static_cast<unsigned>(bigram[0]) << 8U) + bigram[1]];
^32447e5 to
0349dc5
Compare
final pre-commit fixes for pre-commit -a