+/*** UTF-16 ***/
+
+int bget_utf16_be_slow(struct fastbuf *b, uns repl);
+int bget_utf16_le_slow(struct fastbuf *b, uns repl);
+void bput_utf16_be_slow(struct fastbuf *b, uns u);
+void bput_utf16_le_slow(struct fastbuf *b, uns u);
+
+static inline int
+bget_utf16_be_repl(struct fastbuf *b, uns repl)
+{
+ uns u;
+ if (bavailr(b) >= 4)
+ {
+ b->bptr = utf16_be_get_repl(b->bptr, &u, repl);
+ return u;
+ }
+ else
+ return bget_utf16_be_slow(b, repl);
+}
+
+static inline int
+bget_utf16_le_repl(struct fastbuf *b, uns repl)
+{
+ uns u;
+ if (bavailr(b) >= 4)
+ {
+ b->bptr = utf16_le_get_repl(b->bptr, &u, repl);
+ return u;
+ }
+ else
+ return bget_utf16_le_slow(b, repl);
+}
+
+static inline int
+bget_utf16_be(struct fastbuf *b)
+{
+ return bget_utf16_be_repl(b, UNI_REPLACEMENT);
+}
+
+static inline int
+bget_utf16_le(struct fastbuf *b)
+{
+ return bget_utf16_le_repl(b, UNI_REPLACEMENT);
+}
+
+static inline void
+bput_utf16_be(struct fastbuf *b, uns u)
+{
+ if (bavailw(b) >= 4)
+ b->bptr = utf16_be_put(b->bptr, u);
+ else
+ bput_utf16_be_slow(b, u);
+}
+
+static inline void
+bput_utf16_lbe(struct fastbuf *b, uns u)
+{
+ if (bavailw(b) >= 4)
+ b->bptr = utf16_le_put(b->bptr, u);
+ else
+ bput_utf16_le_slow(b, u);
+}
+