MCPcopy Create free account
hub / github.com/ddnet/ddnet / IntsToStr

Function IntsToStr

src/game/gamecore.cpp:91–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91bool IntsToStr(const int *pInts, size_t NumInts, char *pStr, size_t StrSize)
92{
93 dbg_assert(NumInts > 0, "IntsToStr: NumInts invalid");
94 dbg_assert(StrSize >= NumInts * sizeof(int), "IntsToStr: StrSize invalid");
95
96 // Unpack string without validation
97 size_t StrIndex = 0;
98 for(size_t IntIndex = 0; IntIndex < NumInts; IntIndex++)
99 {
100 const int CurrentInt = pInts[IntIndex];
101 pStr[StrIndex] = ((CurrentInt >> 24) & 0xff) - 128;
102 StrIndex++;
103 pStr[StrIndex] = ((CurrentInt >> 16) & 0xff) - 128;
104 StrIndex++;
105 pStr[StrIndex] = ((CurrentInt >> 8) & 0xff) - 128;
106 StrIndex++;
107 pStr[StrIndex] = (CurrentInt & 0xff) - 128;
108 StrIndex++;
109 }
110 // Ensure null-termination
111 pStr[StrIndex - 1] = '\0';
112
113 // Ensure valid UTF-8
114 if(str_utf8_check(pStr))
115 {
116 return true;
117 }
118 pStr[0] = '\0';
119 return false;
120}
121
122float VelocityRamp(float Value, float Start, float Range, float Curvature)
123{

Callers 9

OnNewSnapshotMethod · 0.85
TranslateSnapMethod · 0.85
UpdateTeeRenderInfoMethod · 0.85
LoadMethod · 0.85
ProcessFunction · 0.85
OnNewSnapshotMethod · 0.85
CheckImageDimensionsFunction · 0.85
TESTFunction · 0.85

Calls 1

str_utf8_checkFunction · 0.85

Tested by 1

TESTFunction · 0.68