| 489 | // ================================================================================================= |
| 490 | |
| 491 | void CodePoint_to_UTF8 ( const UTF32Unit cpIn, UTF8Unit * utf8Out, const size_t utf8Len, size_t * utf8Written ) |
| 492 | { |
| 493 | size_t unitCount = 0; |
| 494 | |
| 495 | UC_Assert ( (utf8Out != 0) && (utf8Written != 0) ); |
| 496 | if ( utf8Len == 0 ) goto Done; |
| 497 | if ( cpIn > 0x7F ) goto MultiByte; // ! Force linear execution path for ASCII. |
| 498 | |
| 499 | if ( utf8Len == 0 ) goto Done; |
| 500 | unitCount = 1; |
| 501 | *utf8Out = UTF8Unit(cpIn); |
| 502 | |
| 503 | Done: |
| 504 | *utf8Written = unitCount; |
| 505 | return; |
| 506 | |
| 507 | MultiByte: |
| 508 | CodePoint_to_UTF8_Multi( cpIn, utf8Out, utf8Len, utf8Written ); |
| 509 | return; |
| 510 | |
| 511 | } // CodePoint_to_UTF8 |
| 512 | |
| 513 | // ================================================================================================= |
| 514 |
nothing calls this directly
no test coverage detected