Converts a double variable to binary
| 1565 | |
| 1566 | // Converts a double variable to binary |
| 1567 | FORCE_INLINE |
| 1568 | const char* convert_toDOUBLE(int64_t context, double value, int32_t* out_len) { |
| 1569 | *out_len = sizeof(value); |
| 1570 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1571 | |
| 1572 | if (ret == nullptr) { |
| 1573 | gdv_fn_context_set_error_msg(context, |
| 1574 | "Could not allocate memory for the output string"); |
| 1575 | |
| 1576 | *out_len = 0; |
| 1577 | return ""; |
| 1578 | } |
| 1579 | |
| 1580 | memcpy(ret, &value, *out_len); |
| 1581 | |
| 1582 | return ret; |
| 1583 | } |
| 1584 | |
| 1585 | FORCE_INLINE |
| 1586 | const char* convert_toDOUBLE_be(int64_t context, double value, int32_t* out_len) { |