=== modified file 'uspace/app/bithenge/linux/os.h'
--- uspace/app/bithenge/linux/os.h	2012-06-24 18:44:34 +0000
+++ uspace/app/bithenge/linux/os.h	2012-06-28 12:01:15 +0000
@@ -109,4 +109,14 @@
 	return be32toh(val);
 }
 
+static inline uint32_t uint16_t_le2host(uint32_t val)
+{
+	return le16toh(val);
+}
+
+static inline uint32_t uint16_t_be2host(uint32_t val)
+{
+	return be16toh(val);
+}
+
 #endif

=== modified file 'uspace/app/bithenge/transform.c'
--- uspace/app/bithenge/transform.c	2012-06-27 20:10:30 +0000
+++ uspace/app/bithenge/transform.c	2012-06-28 11:45:43 +0000
@@ -170,6 +170,117 @@
 	&uint32be_ops, 1
 };
 
+
+static int uint16_read_raw(bithenge_transform_t *self, bithenge_node_t *in,
+    uint16_t *raw_value)
+{
+	int rc;
+	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
+		return EINVAL;
+	bithenge_blob_t *blob = bithenge_node_as_blob(in);
+
+	uint16_t val[2];
+	aoff64_t size = sizeof(val[0]) + 1;
+	rc = bithenge_blob_read(blob, 0, (char *)val, &size);
+	if (rc != EOK)
+		return rc;
+	if (size != 2)
+		return EINVAL;
+
+	assert(raw_value != NULL);
+	*raw_value = val[0];
+	return EOK;
+}
+
+static int uint16le_apply(bithenge_transform_t *self, bithenge_node_t *in,
+    bithenge_node_t **out)
+{
+	uint16_t value;
+	int rc = uint16_read_raw(self, in, &value);
+	if (rc != EOK)
+		return rc;
+
+	return bithenge_new_integer_node(out, uint16_t_le2host(value));
+}
+
+static int uint16be_apply(bithenge_transform_t *self, bithenge_node_t *in,
+    bithenge_node_t **out)
+{
+	uint16_t value;
+	int rc = uint16_read_raw(self, in, &value);
+	if (rc != EOK)
+		return rc;
+
+	return bithenge_new_integer_node(out, uint16_t_be2host(value));
+}
+
+static int prefix_length_2(bithenge_transform_t *self, bithenge_blob_t *blob,
+    aoff64_t *out)
+{
+	*out = 2;
+	return EOK;
+}
+
+static const bithenge_transform_ops_t uint16le_ops = {
+	.apply = uint16le_apply,
+	.prefix_length = prefix_length_2,
+	.destroy = transform_indestructible,
+};
+
+static const bithenge_transform_ops_t uint16be_ops = {
+	.apply = uint16be_apply,
+	.prefix_length = prefix_length_2,
+	.destroy = transform_indestructible,
+};
+
+/** The little-endian 16-bit unsigned integer transform. */
+bithenge_transform_t bithenge_uint16le_transform = {
+	&uint16le_ops, 1
+};
+
+/** The big-endian 16-bit unsigned integer transform. */
+bithenge_transform_t bithenge_uint16be_transform = {
+	&uint16be_ops, 1
+};
+
+static int uint8_apply(bithenge_transform_t *self, bithenge_node_t *in,
+    bithenge_node_t **out)
+{
+	int rc;
+	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
+		return EINVAL;
+	bithenge_blob_t *blob = bithenge_node_as_blob(in);
+
+	// Try to read 5 bytes and fail if the blob is too long.
+	uint8_t val[2];
+	aoff64_t size = sizeof(val[0]) + 1;
+	rc = bithenge_blob_read(blob, 0, (char *)val, &size);
+	if (rc != EOK)
+		return rc;
+	if (size != 1)
+		return EINVAL;
+
+	return bithenge_new_integer_node(out, val[0]);
+}
+
+static int prefix_length_1(bithenge_transform_t *self, bithenge_blob_t *blob,
+    aoff64_t *out)
+{
+	*out = 1;
+	return EOK;
+}
+
+static const bithenge_transform_ops_t uint8_ops = {
+	.apply = uint8_apply,
+	.prefix_length = prefix_length_1,
+	.destroy = transform_indestructible,
+};
+
+/** The 8-bit unsigned integer transform. */
+bithenge_transform_t bithenge_uint8_transform = {
+	&uint8_ops, 1
+};
+
 static int zero_terminated_apply(bithenge_transform_t *self,
     bithenge_node_t *in, bithenge_node_t **out)
 {
@@ -229,6 +340,9 @@
 	{"ascii", &bithenge_ascii_transform},
 	{"uint32le", &bithenge_uint32le_transform},
 	{"uint32be", &bithenge_uint32be_transform},
+	{"uint16le", &bithenge_uint16le_transform},
+	{"uint16be", &bithenge_uint16be_transform},
+	{"uint8", &bithenge_uint8_transform},
 	{"zero_terminated", &bithenge_zero_terminated_transform},
 	{NULL, NULL}
 };

