Returns the ASCII character having the binary equivalent to A. If A is larger than 256 the result is equivalent to chr(A % 256).
| 1415 | // Returns the ASCII character having the binary equivalent to A. |
| 1416 | // If A is larger than 256 the result is equivalent to chr(A % 256). |
| 1417 | FORCE_INLINE |
| 1418 | const char* chr_int32(gdv_int64 context, gdv_int32 in, gdv_int32* out_len) { |
| 1419 | in = in % 256; |
| 1420 | *out_len = 1; |
| 1421 | |
| 1422 | char* ret = reinterpret_cast<char*>(gdv_fn_context_arena_malloc(context, *out_len)); |
| 1423 | if (ret == nullptr) { |
| 1424 | gdv_fn_context_set_error_msg(context, "Could not allocate memory for output string"); |
| 1425 | *out_len = 0; |
| 1426 | return ""; |
| 1427 | } |
| 1428 | ret[0] = char(in); |
| 1429 | return ret; |
| 1430 | } |
| 1431 | |
| 1432 | // Returns the ASCII character having the binary equivalent to A. |
| 1433 | // If A is larger than 256 the result is equivalent to chr(A % 256). |