Browse Source

ascii2utf16le fun

master
Mathieu Serandour 1 year ago
parent
commit
840754a05d
  1. 18
      kernel/lib/utf16le.c
  2. 21
      kernel/lib/utf16le.h

18
kernel/lib/utf16le.c

@ -21,4 +21,20 @@ void utf16le2ascii(
break;
}
}
}
}
void ascii2utf16le(
uint16_t* __restrict__ utf16le,
const char* __restrict__ ascii,
size_t len
) {
unsigned char c;
for(;len>0;--len) {
*utf16le++ = c = *ascii++;
if(!c)
break;
}
}

21
kernel/lib/utf16le.h

@ -13,6 +13,23 @@
* @param len maximum length to convert
*/
void utf16le2ascii(
char* __restrict__ ascii,
char* __restrict__ ascii,
const uint16_t* __restrict__ utf16le,
size_t len);
size_t len
);
/**
* @brief convert a ascii encoded
* null-terminated string into a utf16le
* null-terminated string
*
* @param utf16le destination pointer
* @param ascii source pointer
* @param len maximum length to convert
*/
void ascii2utf16le(
uint16_t* __restrict__ utf16le,
const char* __restrict__ ascii,
size_t len
);

Loading…
Cancel
Save