MCPcopy Create free account
hub / github.com/csyonghe/Spire / EncodeString

Method EncodeString

Source/SpireCore/SpirVCodeGen.cpp:940–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938 streamFunctionBody.Add(56 + (1 << 16));
939 }
940 int EncodeString(List<unsigned int> & stream, String S)
941 {
942 auto encoder = CoreLib::IO::Encoding::UTF8;
943 List<char> bytes;
944 encoder->GetBytes(bytes, S);
945 int padding = (4 - (bytes.Count() & 3)) & 3;
946 for (int i = 0; i < padding; i++)
947 bytes.Add(0);
948 int oldSize = stream.Count();
949 stream.SetSize(oldSize + (bytes.Count() >> 2));
950 memcpy(stream.Buffer() + oldSize, bytes.Buffer(), bytes.Count());
951 if (padding==0)
952 stream.Add(0);
953 return stream.Count() - oldSize;
954 }
955 void OpEntryPoint(const ExecutionModel currentExecutionModel, const int entryID, const List<int> &interfaceIDs)
956 {
957 sbTextHeader << LR"(OpEntryPoint )";

Callers

nothing calls this directly

Calls 5

GetBytesMethod · 0.45
CountMethod · 0.45
AddMethod · 0.45
SetSizeMethod · 0.45
BufferMethod · 0.45

Tested by

no test coverage detected