Squashed 'third_party/rawrtc/re/' content from commit f3163ce8b

Change-Id: I6a235e6ac0f03269d951026f9d195da05c40fdab
git-subtree-dir: third_party/rawrtc/re
git-subtree-split: f3163ce8b526a13b35ef71ce4dd6f43585064d8a
diff --git a/src/fmt/ch.c b/src/fmt/ch.c
new file mode 100644
index 0000000..24c4017
--- /dev/null
+++ b/src/fmt/ch.c
@@ -0,0 +1,29 @@
+/**
+ * @file ch.c Character format functions
+ *
+ * Copyright (C) 2010 Creytiv.com
+ */
+#include <re_types.h>
+#include <re_fmt.h>
+
+
+/**
+ * Convert an ASCII hex character to binary format
+ *
+ * @param ch ASCII hex character
+ *
+ * @return Binary value
+ */
+uint8_t ch_hex(char ch)
+{
+	if ('0' <= ch && ch <= '9')
+		return ch - '0';
+
+	else if ('A' <= ch && ch <= 'F')
+		return ch - 'A' + 10;
+
+	else if ('a' <= ch && ch <= 'f')
+		return ch - 'a' + 10;
+
+	return 0;
+}