comparison libcoding/ucs2_bigend.c @ 0:2d0082216916

libcoding: beginning with a subset of uptools version
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 00:46:23 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2d0082216916
1 /*
2 * This library module implements the function for converting a UCS-2
3 * string from native 16-bit words into a byte buffer for SMS.
4 */
5
6 #include <sys/types.h>
7
8 ucs2_out_bigend(inbuf, outbuf, nuni)
9 u_short *inbuf;
10 u_char *outbuf;
11 unsigned nuni;
12 {
13 u_short *ip = inbuf;
14 u_char *op = outbuf;
15 unsigned n, uni;
16
17 for (n = 0; n < nuni; n++) {
18 uni = *ip++;
19 *op++ = uni >> 8;
20 *op++ = uni;
21 }
22 }