10 void tr(uint8_t *codepage
, uint8_t *addr
, uint64_t len
)
14 "1: tr 0(1,%0),0(%2)\n"
16 : "+&a" (addr
), "+a" (len
)
17 : "a" (codepage
) : "cc", "memory", "1");
20 void run_test(void *tran_table
, void *srcaddr
, uint64_t len
)
24 tr(tran_table
, buff
, len
);
25 printf("the translated string is ");
26 for (i
= 0; i
< len
; i
++) {
27 printf("%c", buff
[i
]);
34 /* Test 1: length = 0 */
35 run_test((char *)&touppercase
, &buff
, 0);
36 run_test((char *)&touppercase
, &buff
, 0);
38 /* Test 2 : length > 0 */
40 run_test((char *)&touppercase
, &buff
, 1);
42 memcpy(buff
, "abcdefgh", 8);
43 run_test((char *)&touppercase
, &buff
, 3);
44 run_test((char *)&touppercase
, &buff
, 3);
45 run_test((char *)&touppercase
, &buff
, 8);
47 memcpy(buff
, "ABCDEFGH", 8);
48 run_test((char *)&tolowercase
, &buff
, 3);
49 run_test((char *)&tolowercase
, &buff
, 3);
50 run_test((char *)&tolowercase
, &buff
, 8);
52 memcpy(buff
, "0123456789", 9);
53 run_test((char *)&touppercase
, &buff
, 9);
54 run_test((char *)&tolowercase
, &buff
, 9);