diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libcoding/ucs2_bigend.c	Sat Aug 05 00:46:23 2023 +0000
@@ -0,0 +1,22 @@
+/*
+ * This library module implements the function for converting a UCS-2
+ * string from native 16-bit words into a byte buffer for SMS.
+ */
+
+#include <sys/types.h>
+
+ucs2_out_bigend(inbuf, outbuf, nuni)
+	u_short *inbuf;
+	u_char *outbuf;
+	unsigned nuni;
+{
+	u_short *ip = inbuf;
+	u_char *op = outbuf;
+	unsigned n, uni;
+
+	for (n = 0; n < nuni; n++) {
+		uni = *ip++;
+		*op++ = uni >> 8;
+		*op++ = uni;
+	}
+}