Returns the ASCII character having the binary equivalent to A. If A is larger than 256 the result is equivalent to chr(A % 256).
| 1390 | // Returns the ASCII character having the binary equivalent to A. |
| 1391 | // If A is larger than 256 the result is equivalent to chr(A % 256). |
| 1392 | FORCE_INLINE |
| 1393 | const char* chr_int32(gdv_int64 context, gdv_int32 in, gdv_int32* out_len) { |
| 1394 | in = in % 256; |
| 1395 | *out_len = 1; |
| 1396 | |
| 1397 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1398 | if (ret == nullptr) { |
| 1399 | gdv_fn_context_set_error_msg(context, "Could not allocate memory for output string"); |
| 1400 | *out_len = 0; |
| 1401 | return ""; |
| 1402 | } |
| 1403 | ret[0] = char(in); |
| 1404 | return ret; |
| 1405 | } |
| 1406 | |
| 1407 | // Returns the ASCII character having the binary equivalent to A. |
| 1408 | // If A is larger than 256 the result is equivalent to chr(A % 256). |