Converts an integer(with 32 bits) variable to binary
| 1661 | |
| 1662 | // Converts an integer(with 32 bits) variable to binary |
| 1663 | FORCE_INLINE |
| 1664 | const char* convert_toINT(int64_t context, int32_t value, int32_t* out_len) { |
| 1665 | *out_len = sizeof(value); |
| 1666 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1667 | |
| 1668 | if (ret == nullptr) { |
| 1669 | gdv_fn_context_set_error_msg(context, |
| 1670 | "Could not allocate memory for the output string"); |
| 1671 | |
| 1672 | *out_len = 0; |
| 1673 | return ""; |
| 1674 | } |
| 1675 | |
| 1676 | memcpy(ret, &value, *out_len); |
| 1677 | |
| 1678 | return ret; |
| 1679 | } |
| 1680 | |
| 1681 | FORCE_INLINE |
| 1682 | const char* convert_toINT_be(int64_t context, int32_t value, int32_t* out_len) { |