Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/_speedups.c @ 565:5c617d870bb8
Style
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 06 Jan 2022 22:42:09 +0100 |
| parents | 44e18fbf7741 |
| children | dc2e2384c8c7 |
comparison
equal
deleted
inserted
replaced
| 564:44e18fbf7741 | 565:5c617d870bb8 |
|---|---|
| 171 * Figure out how many bytes the result will require. Turn any | 171 * Figure out how many bytes the result will require. Turn any |
| 172 * illegally large UTF32 things (> Plane 17) into errors (exceptions). | 172 * illegally large UTF32 things (> Plane 17) into errors (exceptions). |
| 173 */ | 173 */ |
| 174 if (ch < (Py_UCS4)0x80) { | 174 if (ch < (Py_UCS4)0x80) { |
| 175 bytesToWrite = 1; | 175 bytesToWrite = 1; |
| 176 } else if (ch < (Py_UCS4)0x800) { | 176 } |
| 177 else if (ch < (Py_UCS4)0x800) { | |
| 177 bytesToWrite = 2; | 178 bytesToWrite = 2; |
| 178 } else if (ch < (Py_UCS4)0x10000) { | 179 } |
| 180 else if (ch < (Py_UCS4)0x10000) { | |
| 179 bytesToWrite = 3; | 181 bytesToWrite = 3; |
| 180 } else if (ch <= UNI_MAX_LEGAL_UTF32) { | 182 } |
| 183 else if (ch <= UNI_MAX_LEGAL_UTF32) { | |
| 181 bytesToWrite = 4; | 184 bytesToWrite = 4; |
| 182 } else { | 185 } |
| 186 else { | |
| 183 _raise_utf8_encode_error( | 187 _raise_utf8_encode_error( |
| 184 ch_obj, | 188 ch_obj, |
| 185 1, ch_obj_end, | 189 1, ch_obj_end, |
| 186 "max Unicode codepoint value exceeded"); | 190 "max Unicode codepoint value exceeded"); |
| 187 return -1; | 191 return -1; |
