MCPcopy Create free account
hub / github.com/alibaba/yalantinglibs / StringLength

Method StringLength

include/ylt/struct_pack/md5_constexpr.hpp:299–308  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////// HELPER FUNCTIONS

Source from the content-addressed store, hash-verified

297 //////////////////////////////////////////////////////////////////////////////
298 // HELPER FUNCTIONS
299 static constexpr uint32_t StringLength(const char *string) {
300 const char *end = string;
301 while (*end != 0) ++end;
302 // Double check that the precision losing conversion is safe.
303 // DCHECK(end >= string);
304 // DCHECK(static_cast<std::ptrdiff_t>(static_cast<uint32_t>(end -
305 // string)) ==
306 // (end - string));
307 return static_cast<uint32_t>(end - string);
308 }
309 static constexpr uint32_t SwapEndian(uint32_t a) {
310 return ((a & 0xff) << 24) | (((a >> 8) & 0xff) << 16) |
311 (((a >> 16) & 0xff) << 8) | ((a >> 24) & 0xff);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected