Go to the source code of this file.
|
void * | bsl::builtin_memset (void *const dst, bsl::int8 const ch, bsl::uintmax const count) noexcept |
| Same as std::memset with parameter checks. If dst is a nullptr, or count is 0, this function returns a nullptr without doing anything. More...
|
|
bsl::int32 | bsl::builtin_memcmp (void const *const lhs, void const *const rhs, bsl::uintmax const count) noexcept |
| Same as std::memcmp with parameter checks. If lhs, rhs are a nullptr, or count is 0, this function returns 0. More...
|
|
constexpr bsl::int32 | bsl::builtin_strncmp (cstr_type const lhs, cstr_type const rhs, bsl::uintmax const count) noexcept |
| Same as std::strncmp with parameter checks. If lhs, rhs are a nullptr, or count is 0, this function returns 0. More...
|
|
constexpr bsl::uintmax | bsl::builtin_strlen (cstr_type const str) noexcept |
| Same as std::strlen with parameter checks. If str is a nullptr, this returns 0. More...
|
|
constexpr cstr_type | bsl::builtin_strnchr (cstr_type const str, char_type const ch, bsl::uintmax const count) noexcept |
| Same as std::strnchr with parameter checks. If str is a nullptr, or count is 0, this function returns a nullptr. More...
|
|
- Copyright
- Copyright (C) 2020 Assured Information Security, Inc.
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
◆ builtin_memset()
Same as std::memset with parameter checks. If dst is a nullptr, or count is 0, this function returns a nullptr without doing anything.
- Note
- Clang currently does not have support for this function in constexpr logic.
- Parameters
-
dst | the buffer to set to all 'ch' |
ch | the value to set the provided buffer to |
count | the total number of bytes to set |
- Returns
- Returns the same result as std::memset.
◆ builtin_memcmp()
Same as std::memcmp with parameter checks. If lhs, rhs are a nullptr, or count is 0, this function returns 0.
- Note
- For now, this function is marked as a non-constexpr as there seems to be a bug in how this function is implemented by Clang with constexpr functions.
- Parameters
-
lhs | the left hand side of the comparison |
rhs | the right hand side of the comparison |
count | the total number of bytes to compare |
- Returns
- Returns the same result as std::memcmp.
◆ builtin_strncmp()
Same as std::strncmp with parameter checks. If lhs, rhs are a nullptr, or count is 0, this function returns 0.
- Parameters
-
lhs | the left hand side of the comparison |
rhs | the right hand side of the comparison |
count | the total number of bytes to compare |
- Returns
- Returns the same result as std::strncmp.
◆ builtin_strlen()
Same as std::strlen with parameter checks. If str is a nullptr, this returns 0.
- Parameters
-
str | a pointer to a string to get the length of |
- Returns
- Returns the same result as std::strlen.
◆ builtin_strnchr()
Same as std::strnchr with parameter checks. If str is a nullptr, or count is 0, this function returns a nullptr.
- Parameters
-
str | the string to search |
ch | the character to look for. |
count | the total number of character in str to search through |
- Returns
- Returns the same result as std::strnchr.