mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -21,7 +21,7 @@ namespace Operators {
|
|||
template<typename Lhs, typename Rhs> \
|
||||
auto operator()(Lhs lhs, Rhs rhs) const { return lhs operation rhs; } \
|
||||
\
|
||||
static StringView name() { return #operation; } \
|
||||
static StringView name() { return #operation##sv; } \
|
||||
}
|
||||
|
||||
DEFINE_BINARY_OPERATOR(Equals, ==);
|
||||
|
@ -54,7 +54,7 @@ struct Divide {
|
|||
}
|
||||
}
|
||||
|
||||
static StringView name() { return "/"; }
|
||||
static StringView name() { return "/"sv; }
|
||||
};
|
||||
struct Modulo {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -69,19 +69,19 @@ struct Modulo {
|
|||
return AK::Result<Lhs, StringView>(lhs % rhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "%"; }
|
||||
static StringView name() { return "%"sv; }
|
||||
};
|
||||
struct BitShiftLeft {
|
||||
template<typename Lhs, typename Rhs>
|
||||
auto operator()(Lhs lhs, Rhs rhs) const { return lhs << (rhs % (sizeof(lhs) * 8)); }
|
||||
|
||||
static StringView name() { return "<<"; }
|
||||
static StringView name() { return "<<"sv; }
|
||||
};
|
||||
struct BitShiftRight {
|
||||
template<typename Lhs, typename Rhs>
|
||||
auto operator()(Lhs lhs, Rhs rhs) const { return lhs >> (rhs % (sizeof(lhs) * 8)); }
|
||||
|
||||
static StringView name() { return ">>"; }
|
||||
static StringView name() { return ">>"sv; }
|
||||
};
|
||||
struct BitRotateLeft {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -94,7 +94,7 @@ struct BitRotateLeft {
|
|||
return (lhs << rhs) | (lhs >> ((-rhs) & mask));
|
||||
}
|
||||
|
||||
static StringView name() { return "rotate_left"; }
|
||||
static StringView name() { return "rotate_left"sv; }
|
||||
};
|
||||
struct BitRotateRight {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -107,7 +107,7 @@ struct BitRotateRight {
|
|||
return (lhs >> rhs) | (lhs << ((-rhs) & mask));
|
||||
}
|
||||
|
||||
static StringView name() { return "rotate_right"; }
|
||||
static StringView name() { return "rotate_right"sv; }
|
||||
};
|
||||
struct Minimum {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -126,7 +126,7 @@ struct Minimum {
|
|||
return min(lhs, rhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "minimum"; }
|
||||
static StringView name() { return "minimum"sv; }
|
||||
};
|
||||
struct Maximum {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -145,7 +145,7 @@ struct Maximum {
|
|||
return max(lhs, rhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "maximum"; }
|
||||
static StringView name() { return "maximum"sv; }
|
||||
};
|
||||
struct CopySign {
|
||||
template<typename Lhs, typename Rhs>
|
||||
|
@ -159,7 +159,7 @@ struct CopySign {
|
|||
static_assert(DependentFalse<Lhs, Rhs>, "Invalid types to CopySign");
|
||||
}
|
||||
|
||||
static StringView name() { return "copysign"; }
|
||||
static StringView name() { return "copysign"sv; }
|
||||
};
|
||||
|
||||
// Unary
|
||||
|
@ -168,7 +168,7 @@ struct EqualsZero {
|
|||
template<typename Lhs>
|
||||
auto operator()(Lhs lhs) const { return lhs == 0; }
|
||||
|
||||
static StringView name() { return "== 0"; }
|
||||
static StringView name() { return "== 0"sv; }
|
||||
};
|
||||
struct CountLeadingZeros {
|
||||
template<typename Lhs>
|
||||
|
@ -183,7 +183,7 @@ struct CountLeadingZeros {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "clz"; }
|
||||
static StringView name() { return "clz"sv; }
|
||||
};
|
||||
struct CountTrailingZeros {
|
||||
template<typename Lhs>
|
||||
|
@ -198,7 +198,7 @@ struct CountTrailingZeros {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "ctz"; }
|
||||
static StringView name() { return "ctz"sv; }
|
||||
};
|
||||
struct PopCount {
|
||||
template<typename Lhs>
|
||||
|
@ -210,19 +210,19 @@ struct PopCount {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "popcnt"; }
|
||||
static StringView name() { return "popcnt"sv; }
|
||||
};
|
||||
struct Absolute {
|
||||
template<typename Lhs>
|
||||
auto operator()(Lhs lhs) const { return AK::abs(lhs); }
|
||||
|
||||
static StringView name() { return "abs"; }
|
||||
static StringView name() { return "abs"sv; }
|
||||
};
|
||||
struct Negate {
|
||||
template<typename Lhs>
|
||||
auto operator()(Lhs lhs) const { return -lhs; }
|
||||
|
||||
static StringView name() { return "== 0"; }
|
||||
static StringView name() { return "== 0"sv; }
|
||||
};
|
||||
struct Ceil {
|
||||
template<typename Lhs>
|
||||
|
@ -236,7 +236,7 @@ struct Ceil {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "ceil"; }
|
||||
static StringView name() { return "ceil"sv; }
|
||||
};
|
||||
struct Floor {
|
||||
template<typename Lhs>
|
||||
|
@ -250,7 +250,7 @@ struct Floor {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "floor"; }
|
||||
static StringView name() { return "floor"sv; }
|
||||
};
|
||||
struct Truncate {
|
||||
template<typename Lhs>
|
||||
|
@ -264,7 +264,7 @@ struct Truncate {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "truncate"; }
|
||||
static StringView name() { return "truncate"sv; }
|
||||
};
|
||||
struct NearbyIntegral {
|
||||
template<typename Lhs>
|
||||
|
@ -278,7 +278,7 @@ struct NearbyIntegral {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "round"; }
|
||||
static StringView name() { return "round"sv; }
|
||||
};
|
||||
struct SquareRoot {
|
||||
template<typename Lhs>
|
||||
|
@ -292,7 +292,7 @@ struct SquareRoot {
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static StringView name() { return "sqrt"; }
|
||||
static StringView name() { return "sqrt"sv; }
|
||||
};
|
||||
|
||||
template<typename Result>
|
||||
|
@ -303,7 +303,7 @@ struct Wrap {
|
|||
return static_cast<MakeUnsigned<Result>>(bit_cast<MakeUnsigned<Lhs>>(lhs));
|
||||
}
|
||||
|
||||
static StringView name() { return "wrap"; }
|
||||
static StringView name() { return "wrap"sv; }
|
||||
};
|
||||
|
||||
template<typename ResultT>
|
||||
|
@ -331,7 +331,7 @@ struct CheckedTruncate {
|
|||
return static_cast<ResultT>(truncated);
|
||||
}
|
||||
|
||||
static StringView name() { return "truncate.checked"; }
|
||||
static StringView name() { return "truncate.checked"sv; }
|
||||
};
|
||||
|
||||
template<typename ResultT>
|
||||
|
@ -342,7 +342,7 @@ struct Extend {
|
|||
return lhs;
|
||||
}
|
||||
|
||||
static StringView name() { return "extend"; }
|
||||
static StringView name() { return "extend"sv; }
|
||||
};
|
||||
|
||||
template<typename ResultT>
|
||||
|
@ -354,7 +354,7 @@ struct Convert {
|
|||
return static_cast<ResultT>(signed_interpretation);
|
||||
}
|
||||
|
||||
static StringView name() { return "convert"; }
|
||||
static StringView name() { return "convert"sv; }
|
||||
};
|
||||
|
||||
template<typename ResultT>
|
||||
|
@ -365,7 +365,7 @@ struct Reinterpret {
|
|||
return bit_cast<ResultT>(lhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "reinterpret"; }
|
||||
static StringView name() { return "reinterpret"sv; }
|
||||
};
|
||||
|
||||
struct Promote {
|
||||
|
@ -376,7 +376,7 @@ struct Promote {
|
|||
return static_cast<double>(lhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "promote"; }
|
||||
static StringView name() { return "promote"sv; }
|
||||
};
|
||||
|
||||
struct Demote {
|
||||
|
@ -391,7 +391,7 @@ struct Demote {
|
|||
return static_cast<float>(lhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "demote"; }
|
||||
static StringView name() { return "demote"sv; }
|
||||
};
|
||||
|
||||
template<typename InitialType>
|
||||
|
@ -405,7 +405,7 @@ struct SignExtend {
|
|||
return static_cast<Lhs>(initial_value);
|
||||
}
|
||||
|
||||
static StringView name() { return "extend"; }
|
||||
static StringView name() { return "extend"sv; }
|
||||
};
|
||||
|
||||
template<typename ResultT>
|
||||
|
@ -439,7 +439,7 @@ struct SaturatingTruncate {
|
|||
return convert(trunc(lhs));
|
||||
}
|
||||
|
||||
static StringView name() { return "truncate.saturating"; }
|
||||
static StringView name() { return "truncate.saturating"sv; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue