MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / appendUnsigned

Method appendUnsigned

Libraries/Http/HttpHeaders.cpp:209–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208
209 static bool appendUnsigned(Span<char> storage, size_t& offset, uint32_t value)
210 {
211 char reversed[10];
212 size_t digits = 0;
213 do
214 {
215 reversed[digits++] = static_cast<char>('0' + (value % 10));
216 value /= 10;
217 } while (value > 0 and digits < sizeof(reversed));
218
219 if (value > 0 or offset + digits > storage.sizeInBytes())
220 {
221 return false;
222 }
223 for (size_t idx = 0; idx < digits; ++idx)
224 {
225 storage.data()[offset + idx] = reversed[digits - idx - 1];
226 }
227 offset += digits;
228 return true;
229 }
230
231 static Result appendCacheDirective(Span<char> storage, size_t& offset, bool& first, StringSpan directive)
232 {

Callers

nothing calls this directly

Calls 2

sizeInBytesMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected