diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-28 14:07:11 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-28 14:07:11 +0000 |
commit | 16677ce311fd70162cc9f7cfe2ab97461df765fc (patch) | |
tree | b6c76957d31774814f3a8203ab9035f910107f74 /py/misc.h | |
parent | 0ecd5988a24aaa72415d83961327fc034cfe64a2 (diff) | |
download | micropython-16677ce311fd70162cc9f7cfe2ab97461df765fc.tar.gz micropython-16677ce311fd70162cc9f7cfe2ab97461df765fc.zip |
py: Be more precise about unicode type and disabled unicode behaviour.
Diffstat (limited to 'py/misc.h')
-rw-r--r-- | py/misc.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -92,7 +92,15 @@ size_t m_get_peak_bytes_allocated(void); /** unichar / UTF-8 *********************************************/ -typedef int unichar; // TODO +#if MICROPY_PY_BUILTINS_STR_UNICODE +#include <stdint.h> // only include if we need it +// with unicode enabled we need a type which can fit chars up to 0x10ffff +typedef uint32_t unichar; +#else +// without unicode enabled we can only need to fit chars up to 0xff +// (on 16-bit archs uint is 16-bits and more efficient than uint32_t) +typedef uint unichar; +#endif unichar utf8_get_char(const byte *s); const byte *utf8_next_char(const byte *s); |