| 41 | } |
| 42 | |
| 43 | void writeI53ToI64Clamped_double(int64_t *heapAddress, double num) { |
| 44 | #ifdef GENERATE_ANSWERS |
| 45 | if (num >= 9223372036854775808.0) |
| 46 | *heapAddress = 0x7FFFFFFFFFFFFFFFLL; |
| 47 | else if (num <= -9223372036854775808.0) |
| 48 | *heapAddress = -0x8000000000000000LL; |
| 49 | else if (num > 0) |
| 50 | *(uint64_t*)heapAddress = (uint64_t)num; |
| 51 | else |
| 52 | *heapAddress = (int64_t)num; |
| 53 | #else |
| 54 | EM_ASM(writeI53ToI64Clamped($0, $1), heapAddress, num); |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | void writeI53ToI64Signaling_double(int64_t *heapAddress, double num) { |
| 59 | #ifdef GENERATE_ANSWERS |