mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Update for C++17 and fix MSVC warnings (#1694)
* Update MSVC arguments * Fix json allocator * Fix simulation diamond * Bump gtest * Remove empty varargs in unit tests * Replace test case with test suite * Remove deprecation warning in optional * Remove need for NOMIXMAX to be defined in wpilib headers
This commit is contained in:
committed by
Peter Johnson
parent
fb1239a2ad
commit
221011494d
@@ -60,14 +60,14 @@ inline unsigned hexDigitValue(char C) {
|
||||
if (C >= '0' && C <= '9') return C-'0';
|
||||
if (C >= 'a' && C <= 'f') return C-'a'+10U;
|
||||
if (C >= 'A' && C <= 'F') return C-'A'+10U;
|
||||
return -1U;
|
||||
return (std::numeric_limits<unsigned>::max)();
|
||||
}
|
||||
|
||||
/// Checks if character \p C is one of the 10 decimal digits.
|
||||
inline bool isDigit(char C) { return C >= '0' && C <= '9'; }
|
||||
|
||||
/// Checks if character \p C is a hexadecimal numeric character.
|
||||
inline bool isHexDigit(char C) { return hexDigitValue(C) != -1U; }
|
||||
inline bool isHexDigit(char C) { return hexDigitValue(C) != (std::numeric_limits<unsigned>::max)(); }
|
||||
|
||||
/// Checks if character \p C is a valid letter as classified by "C" locale.
|
||||
inline bool isAlpha(char C) {
|
||||
@@ -151,7 +151,7 @@ inline std::string toHex(ArrayRef<uint8_t> Input, bool LowerCase = false) {
|
||||
inline uint8_t hexFromNibbles(char MSB, char LSB) {
|
||||
unsigned U1 = hexDigitValue(MSB);
|
||||
unsigned U2 = hexDigitValue(LSB);
|
||||
assert(U1 != -1U && U2 != -1U);
|
||||
assert(U1 != (std::numeric_limits<unsigned>::max)() && U2 != (std::numeric_limits<unsigned>::max)());
|
||||
|
||||
return static_cast<uint8_t>((U1 << 4) | U2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user