MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / PD_PString_GetMutableDataPointer

Function PD_PString_GetMutableDataPointer

paddle/phi/common/cpstring_impl.h:379–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379HOSTDEVICE static inline char *PD_PString_GetMutableDataPointer(
380 PD_PString *str) {
381 switch (PD_PString_GetType(str)) {
382 case PD_PSTR_SMALL:
383 return str->u.small.str;
384 case PD_PSTR_OFFSET:
385 case PD_PSTR_VIEW:
386 // Convert OFFSET/VIEW to SMALL/LARGE
387 PD_PString_ResizeUninitialized(str, PD_PString_GetSize(str));
388 return (PD_PString_GetType(str) == PD_PSTR_SMALL) ? str->u.small.str
389 : str->u.large.ptr;
390 case PD_PSTR_LARGE:
391 return str->u.large.ptr;
392 default:
393 // Unreachable.
394 return NULL; // NOLINT
395 }
396}
397
398HOSTDEVICE static inline void PD_PString_Reserve(PD_PString *str,
399 size_t new_cap) {

Callers 1

mdataMethod · 0.85

Calls 2

PD_PString_GetSizeFunction · 0.85

Tested by

no test coverage detected