mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Issue #357 - Do not truncate results of integer division
This commit is contained in:
parent
ec4a0cd02a
commit
4c0bf87f8b
2 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
## 0.15 - TBD
|
||||
|
||||
Bug Fixes
|
||||
|
||||
- Prevent truncation when dividing two fixnums.
|
||||
|
||||
## 0.14 - February 11, 2020
|
||||
|
||||
Cyclone now automatically relocates any stack objects when performing a mutation. This prevents a whole range of race conditions that had previously been possible in multithreaded application code. And since this work is done by the Cyclone runtime no special code needs to be added to your applications.
|
||||
|
|
|
@ -3969,7 +3969,6 @@ object Cyc_fast_mul(void *data, object ptr, object x, object y) {
|
|||
}
|
||||
|
||||
object Cyc_fast_div(void *data, object ptr, object x, object y) {
|
||||
int z;
|
||||
// x is int (assume value types for integers)
|
||||
if (obj_is_int(x)){
|
||||
if (obj_is_int(y)){
|
||||
|
@ -3977,8 +3976,8 @@ object Cyc_fast_div(void *data, object ptr, object x, object y) {
|
|||
// Overflow can occur if y = 0 || (x = 0x80000000 && y = -1)
|
||||
// We already check for 0 above and the value of x above is a
|
||||
// bignum, so no futher checks are required.
|
||||
z = obj_obj2int(x) / obj_obj2int(y);
|
||||
return obj_int2obj(z);
|
||||
assign_double(ptr, (double)(obj_obj2int(x)) / obj_obj2int(y));
|
||||
return ptr;
|
||||
} else if (is_object_type(y) && type_of(y) == double_tag) {
|
||||
assign_double(ptr, (double)(obj_obj2int(x)) / double_value(y));
|
||||
return ptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue