| 273 | } |
| 274 | |
| 275 | void EncodeStream::writeFloatList(const float* values, uint32_t count, float precision) { |
| 276 | if (count == 0) { |
| 277 | writeUBits(0, LENGTH_FOR_STORE_NUM_BITS); |
| 278 | return; |
| 279 | } |
| 280 | auto scale = 1 / precision; |
| 281 | auto list = new int32_t[count]; |
| 282 | for (uint32_t i = 0; i < count; i++) { |
| 283 | list[i] = static_cast<int32_t>(roundf(values[i] * scale)); |
| 284 | } |
| 285 | writeInt32List(list, count); |
| 286 | delete[] list; |
| 287 | } |
| 288 | |
| 289 | void EncodeStream::writePoint2DList(const Point* points, uint32_t count, float precision) { |
| 290 | auto list = new float[count * 2 + 1]; |
no outgoing calls
no test coverage detected