I wanted to use the builtin function __cu21 to convert UTF-16 to UTF-8 in a C program.
int __cu21(char *op1, unsigned long op1_len, unsigned short *op2, unsigned long op2_len,unsigned char mask);
At the end of the CU21 ASM instruction (CU21 R1,R2[,M3]), the contents of register R1+1 are decremented by the number of bytes placed at R1 location. This allows to know exactly the length of the UTF-8 sequence generated.
It seems that I can't get this length with C interface.
Moreover, I can't handle return code 1 (opt1 too small) without either parsing the buffer to know the length already converted or restarting the conversion from beggining.
Can someone explain me why __cu21 doesn't use prototype like iconv which allows to get the registers value at the end of ASM instruction ?
Thanks for your help.