MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / convertAndAddToBuff

Method convertAndAddToBuff

src/thundersvm/util/log.cpp:909–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907 }
908
909 char* Str::convertAndAddToBuff(std::size_t n, int len, char* buf, const char* bufLim, bool zeroPadded) {
910 char localBuff[10] = "";
911 char* p = localBuff + sizeof(localBuff) - 2;
912 if (n > 0) {
913 for (; n > 0 && p > localBuff && len > 0; n /= 10, --len)
914 *--p = static_cast<char>(n % 10 + '0');
915 } else {
916 *--p = '0';
917 --len;
918 }
919 if (zeroPadded)
920 while (p > localBuff && len-- > 0) *--p = static_cast<char>('0');
921 return addToBuff(p, buf, bufLim);
922 }
923
924 char* Str::addToBuff(const char* str, char* buf, const char* bufLim) {
925 while ((buf < bufLim) && ((*buf = *str++) != '\0'))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected