ast2firm: Implement casting from complex to real types.
[cparser] / unicode.h
index 44a9b92..347f275 100644 (file)
--- a/unicode.h
+++ b/unicode.h
@@ -1,3 +1,7 @@
+/*
+ * This file is part of cparser.
+ * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
+ */
 #ifndef UNICODE_H
 #define UNICODE_H
 
@@ -50,16 +54,17 @@ static inline void obstack_grow_utf8(struct obstack *const obst, utf32 const c)
        if (c < 0x80U) {
                obstack_1grow(obst, c);
        } else if (c < 0x800) {
-               obstack_1grow(obst, 0xC0 | (c >> 6));
-               obstack_1grow(obst, 0x80 | (c & 0x3F));
+               obstack_1grow(obst, 0xC0 |  (c >>  6));
+               goto one_more;
        } else if (c < 0x10000) {
-               obstack_1grow(obst, 0xE0 | ( c >> 12));
-               obstack_1grow(obst, 0x80 | ((c >>  6) & 0x3F));
-               obstack_1grow(obst, 0x80 | ( c        & 0x3F));
+               obstack_1grow(obst, 0xE0 |  (c >> 12));
+               goto two_more;
        } else {
-               obstack_1grow(obst, 0xF0 | c >> 18));
+               obstack_1grow(obst, 0xF0 |  (c >> 18));
                obstack_1grow(obst, 0x80 | ((c >> 12) & 0x3F));
+two_more:
                obstack_1grow(obst, 0x80 | ((c >>  6) & 0x3F));
+one_more:
                obstack_1grow(obst, 0x80 | ( c        & 0x3F));
        }
 }