aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libn.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/libn.h b/include/libn.h
index f469c5c..835d2c1 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -136,22 +136,24 @@ void str·replace(string s, const byte* from, const byte* to);
string* str·split(string s, const byte* tok);
string str·join(vlong len, byte** fields, const byte* sep);
- /*
+/*
* UTF-8 functions.
* Perhaps break into own unit
* TODO: Add to(upper|lower|title)
*/
typedef uint32 rune;
-enum
-{
- UTFmax = 4,
- RuneSync = 0x80,
- RuneSelf = 0x80,
- RuneErr = 0xFFFD,
- RuneMax = 0x10FFFF,
- RuneMask = 0x1FFFFF,
-};
+/*
+ * We have to use the preprocessor to ensure
+ * we have unsigned constants. Unfortunate...
+ */
+
+#define UTFmax 4
+#define RuneSync 0x80u
+#define RuneSelf 0x80u
+#define RuneErr 0xFFFDu
+#define RuneMax 0x10FFFFu
+#define RuneMask 0x1FFFFFu
/* utf8 helpers */
int utf8·fullrune(byte *s, int n);