168 * \param value Value to write |
168 * \param value Value to write |
169 */ |
169 */ |
170 void Bytestream::writeShort(int16_t value) |
170 void Bytestream::writeShort(int16_t value) |
171 { |
171 { |
172 m_data.reserve(m_data.size() + 2); |
172 m_data.reserve(m_data.size() + 2); |
173 for (int i : range(2)) |
173 for (int i : {0, 1}) |
174 m_data.push_back((value >> (i * 8)) & 0xFF); |
174 m_data.push_back((value >> (i * 8)) & 0xFF); |
175 } |
175 } |
176 |
176 |
177 /*! |
177 /*! |
178 * \brief Writes an integer to the end of the data as 4 bytes. |
178 * \brief Writes an integer to the end of the data as 4 bytes. |
179 * \param value Value to write |
179 * \param value Value to write |
180 */ |
180 */ |
181 void Bytestream::writeLong(int32_t value) |
181 void Bytestream::writeLong(int32_t value) |
182 { |
182 { |
183 m_data.reserve(m_data.size() + 4); |
183 m_data.reserve(m_data.size() + 4); |
184 for (int i : range(4)) |
184 for (int i = 0; i < 4; i += 1) |
185 m_data.push_back((value >> (i * 8)) & 0xFF); |
185 m_data.push_back((value >> (i * 8)) & 0xFF); |
186 } |
186 } |
187 |
187 |
188 /*! |
188 /*! |
189 * \brief Writes a floating-point number to the end of the data. |
189 * \brief Writes a floating-point number to the end of the data. |