Floating point division is now relying on underlying FPU and IEEE for behavior with respect to divide by 0
Showing the changes to src/vm/string.cpp (1 of 11 files). Show all
Unified · Split
| @@ -217,7 +217,7 @@ vm_string_t::vm_string_t(std::size_t encoded_str_len, const uint8_t *encoded_str · 216 unmodified lines | ||
| 217 | 217 | { |
| 218 | 218 | // If we are going to allocate, make sure it is larger than needed. |
| 219 | 219 | _length_max = compute_max_length(_length); |
| 220 | − _mem.alloc = calloc_memory<uint8_t>(_length_max * _character_size); | |
| 220 | + _mem.alloc = alloc_memory<uint8_t>(_length_max * _character_size); | |
| 221 | 221 | _is_alloc = true; |
| 222 | 222 | |
| 223 | 223 | dest = _mem.alloc; |
| @@ -248,7 +248,7 @@ vm_string_t::vm_string_t(const vm_string_t &s1, const vm_string_t &s2) · 24 unmodified lines | ||
| 248 | 248 | , _length_max{ compute_max_length(s1._length + s2._length) } |
| 249 | 249 | , _mem{} |
| 250 | 250 | { |
| 251 | − _mem.alloc = calloc_memory<uint8_t>(_length_max * _character_size); | |
| 251 | + _mem.alloc = alloc_memory<uint8_t>(_length_max * _character_size); | |
| 252 | 252 | |
| 253 | 253 | const auto s1_data = (s1._is_alloc) ? s1._mem.alloc : s1._mem.local; |
| 254 | 254 | const auto s2_data = (s2._is_alloc) ? s2._mem.alloc : s2._mem.local; |
| @@ -290,7 +290,7 @@ vm_string_t::vm_string_t(const vm_string_t &other, word_t begin_index, word_t en · 35 unmodified lines | ||
| 290 | 290 | if (_is_alloc) |
| 291 | 291 | { |
| 292 | 292 | src = other._mem.alloc; |
| 293 | − _mem.alloc = calloc_memory<uint8_t>(_length_max); | |
| 293 | + _mem.alloc = alloc_memory<uint8_t>(_length_max); | |
| 294 | 294 | dest = _mem.alloc; |
| 295 | 295 | } |
| 296 | 296 | |
| @@ -358,9 +358,9 @@ vm_string_t &vm_string_t::append(const vm_string_t &other) · 61 unmodified lines | ||
| 358 | 358 | |
| 359 | 359 | // Check if this string and the supplied string have the same character size. |
| 360 | 360 | if (new_is_rune) |
| 361 | − new_source = calloc_memory<uint8_t>(new_length_max * sizeof(rune_t)); | |
| 361 | + new_source = alloc_memory<uint8_t>(new_length_max * sizeof(rune_t)); | |
| 362 | 362 | else |
| 363 | − new_source = calloc_memory<uint8_t>(new_length_max); | |
| 363 | + new_source = alloc_memory<uint8_t>(new_length_max); | |
| 364 | 364 | |
| 365 | 365 | // Combine the two string sources |
| 366 | 366 | combine( |
| @@ -449,7 +449,7 @@ void vm_string_t::set_rune(word_t index, rune_t value) · 82 unmodified lines | ||
| 449 | 449 | assert(_character_size == sizeof(rune_t)); |
| 450 | 450 | |
| 451 | 451 | _length_max = (_length == 0) ? static_cast<word_t>(compute_max_length(_mem.local)) : compute_max_length(_length); |
| 452 | − auto new_alloc = calloc_memory<rune_t>(_length_max * _character_size); | |
| 452 | + auto new_alloc = alloc_memory<rune_t>(_length_max * _character_size); | |
| 453 | 453 | |
| 454 | 454 | // Copy source into the new alloc. |
| 455 | 455 | copy_characters_to(new_alloc, 0, source, _length); |
| @@ -467,7 +467,7 @@ void vm_string_t::set_rune(word_t index, rune_t value) · 11 unmodified lines | ||
| 467 | 467 | else if (static_cast<word_t>(_length_max) <= index) // Check if string can accomodate the new character. |
| 468 | 468 | { |
| 469 | 469 | _length_max = (_length == 0) ? static_cast<word_t>(compute_max_length(_mem.local)) : compute_max_length(_length); |
| 470 | − auto new_alloc = calloc_memory<uint8_t>(_length_max * _character_size); | |
| 470 | + auto new_alloc = alloc_memory<uint8_t>(_length_max * _character_size); | |
| 471 | 471 | std::memcpy(new_alloc, source, _length * _character_size); |
| 472 | 472 | |
| 473 | 473 | // Free memory, if allocated |