MCPcopy Create free account
hub / github.com/adamstark/AudioFile / addInt32ToFileData

Method addInt32ToFileData

AudioFile.h:1157–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1155//=============================================================
1156template <class T>
1157void AudioFile<T>::addInt32ToFileData (std::vector<uint8_t>& fileData, int32_t i, Endianness endianness)
1158{
1159 uint8_t bytes[4];
1160
1161 if (endianness == Endianness::LittleEndian)
1162 {
1163 bytes[3] = (i >> 24) & 0xFF;
1164 bytes[2] = (i >> 16) & 0xFF;
1165 bytes[1] = (i >> 8) & 0xFF;
1166 bytes[0] = i & 0xFF;
1167 }
1168 else
1169 {
1170 bytes[0] = (i >> 24) & 0xFF;
1171 bytes[1] = (i >> 16) & 0xFF;
1172 bytes[2] = (i >> 8) & 0xFF;
1173 bytes[3] = i & 0xFF;
1174 }
1175
1176 for (int j = 0; j < 4; j++)
1177 fileData.push_back (bytes[j]);
1178}
1179
1180//=============================================================
1181template <class T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected