Converts a float variable to binary
| 1597 | |
| 1598 | // Converts a float variable to binary |
| 1599 | FORCE_INLINE |
| 1600 | const char* convert_toFLOAT(int64_t context, float value, int32_t* out_len) { |
| 1601 | *out_len = sizeof(value); |
| 1602 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1603 | |
| 1604 | if (ret == nullptr) { |
| 1605 | gdv_fn_context_set_error_msg(context, |
| 1606 | "Could not allocate memory for the output string"); |
| 1607 | |
| 1608 | *out_len = 0; |
| 1609 | return ""; |
| 1610 | } |
| 1611 | |
| 1612 | memcpy(ret, &value, *out_len); |
| 1613 | |
| 1614 | return ret; |
| 1615 | } |
| 1616 | |
| 1617 | FORCE_INLINE |
| 1618 | const char* convert_toFLOAT_be(int64_t context, float value, int32_t* out_len) { |