| Replace V with Nim 472eb49 nandithebull 13h ago | 1 | /* Generated by Nim Compiler v2.2.0 */ |
| 2 | #define NIM_INTBITS 64 |
| 3 | |
| 4 | #include "nimbase.h" |
| 5 | #include <string.h> |
| 6 | #undef LANGUAGE_C |
| 7 | #undef MIPSEB |
| 8 | #undef MIPSEL |
| 9 | #undef PPC |
| 10 | #undef R3000 |
| 11 | #undef R4000 |
| 12 | #undef i386 |
| 13 | #undef linux |
| 14 | #undef mips |
| 15 | #undef near |
| 16 | #undef far |
| 17 | #undef powerpc |
| 18 | #undef unix |
| 19 | typedef struct NimStrPayload NimStrPayload; |
| 20 | typedef struct NimStringV2 NimStringV2; |
| 21 | struct NimStrPayload { |
| 22 | NI cap; |
| 23 | NIM_CHAR data[SEQ_DECL_SIZE]; |
| 24 | }; |
| 25 | struct NimStringV2 { |
| 26 | NI len; |
| 27 | NimStrPayload* p; |
| 28 | }; |
| 29 | typedef NIM_CHAR tyArray__PbS9a6gkxCuxWEnFq4lOU9aw[24]; |
| 30 | typedef NIM_CHAR tyArray__38Z69amCaoywES5tRmClBSw[200]; |
| 31 | static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1); |
| 32 | N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s_p0, NI addLen_p1); |
| 33 | N_LIB_PRIVATE N_NIMCALL(void, addInt__stdZprivateZdigitsutils_u175)(NimStringV2* result_p0, NU64 x_p1); |
| 34 | static N_INLINE(void, addIntImpl__stdZprivateZdigitsutils_u55)(NimStringV2* result_p0, NU64 x_p1); |
| 35 | static N_INLINE(void, addChars__stdZprivateZdigitsutils_u98)(NimStringV2* result_p0, tyArray__PbS9a6gkxCuxWEnFq4lOU9aw x_p1, NI start_p2, NI n_p3); |
| 36 | N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1); |
| 37 | static N_INLINE(void, copyMem__system_u1726)(void* dest_p0, void* source_p1, NI size_p2); |
| 38 | static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2); |
| 39 | static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); |
| 40 | N_LIB_PRIVATE NIM_CONST tyArray__38Z69amCaoywES5tRmClBSw digits100__stdZprivateZdigitsutils_u2 = {48, |
| 41 | 48, |
| 42 | 48, |
| 43 | 49, |
| 44 | 48, |
| 45 | 50, |
| 46 | 48, |
| 47 | 51, |
| 48 | 48, |
| 49 | 52, |
| 50 | 48, |
| 51 | 53, |
| 52 | 48, |
| 53 | 54, |
| 54 | 48, |
| 55 | 55, |
| 56 | 48, |
| 57 | 56, |
| 58 | 48, |
| 59 | 57, |
| 60 | 49, |
| 61 | 48, |
| 62 | 49, |
| 63 | 49, |
| 64 | 49, |
| 65 | 50, |
| 66 | 49, |
| 67 | 51, |
| 68 | 49, |
| 69 | 52, |
| 70 | 49, |
| 71 | 53, |
| 72 | 49, |
| 73 | 54, |
| 74 | 49, |
| 75 | 55, |
| 76 | 49, |
| 77 | 56, |
| 78 | 49, |
| 79 | 57, |
| 80 | 50, |
| 81 | 48, |
| 82 | 50, |
| 83 | 49, |
| 84 | 50, |
| 85 | 50, |
| 86 | 50, |
| 87 | 51, |
| 88 | 50, |
| 89 | 52, |
| 90 | 50, |
| 91 | 53, |
| 92 | 50, |
| 93 | 54, |
| 94 | 50, |
| 95 | 55, |
| 96 | 50, |
| 97 | 56, |
| 98 | 50, |
| 99 | 57, |
| 100 | 51, |
| 101 | 48, |
| 102 | 51, |
| 103 | 49, |
| 104 | 51, |
| 105 | 50, |
| 106 | 51, |
| 107 | 51, |
| 108 | 51, |
| 109 | 52, |
| 110 | 51, |
| 111 | 53, |
| 112 | 51, |
| 113 | 54, |
| 114 | 51, |
| 115 | 55, |
| 116 | 51, |
| 117 | 56, |
| 118 | 51, |
| 119 | 57, |
| 120 | 52, |
| 121 | 48, |
| 122 | 52, |
| 123 | 49, |
| 124 | 52, |
| 125 | 50, |
| 126 | 52, |
| 127 | 51, |
| 128 | 52, |
| 129 | 52, |
| 130 | 52, |
| 131 | 53, |
| 132 | 52, |
| 133 | 54, |
| 134 | 52, |
| 135 | 55, |
| 136 | 52, |
| 137 | 56, |
| 138 | 52, |
| 139 | 57, |
| 140 | 53, |
| 141 | 48, |
| 142 | 53, |
| 143 | 49, |
| 144 | 53, |
| 145 | 50, |
| 146 | 53, |
| 147 | 51, |
| 148 | 53, |
| 149 | 52, |
| 150 | 53, |
| 151 | 53, |
| 152 | 53, |
| 153 | 54, |
| 154 | 53, |
| 155 | 55, |
| 156 | 53, |
| 157 | 56, |
| 158 | 53, |
| 159 | 57, |
| 160 | 54, |
| 161 | 48, |
| 162 | 54, |
| 163 | 49, |
| 164 | 54, |
| 165 | 50, |
| 166 | 54, |
| 167 | 51, |
| 168 | 54, |
| 169 | 52, |
| 170 | 54, |
| 171 | 53, |
| 172 | 54, |
| 173 | 54, |
| 174 | 54, |
| 175 | 55, |
| 176 | 54, |
| 177 | 56, |
| 178 | 54, |
| 179 | 57, |
| 180 | 55, |
| 181 | 48, |
| 182 | 55, |
| 183 | 49, |
| 184 | 55, |
| 185 | 50, |
| 186 | 55, |
| 187 | 51, |
| 188 | 55, |
| 189 | 52, |
| 190 | 55, |
| 191 | 53, |
| 192 | 55, |
| 193 | 54, |
| 194 | 55, |
| 195 | 55, |
| 196 | 55, |
| 197 | 56, |
| 198 | 55, |
| 199 | 57, |
| 200 | 56, |
| 201 | 48, |
| 202 | 56, |
| 203 | 49, |
| 204 | 56, |
| 205 | 50, |
| 206 | 56, |
| 207 | 51, |
| 208 | 56, |
| 209 | 52, |
| 210 | 56, |
| 211 | 53, |
| 212 | 56, |
| 213 | 54, |
| 214 | 56, |
| 215 | 55, |
| 216 | 56, |
| 217 | 56, |
| 218 | 56, |
| 219 | 57, |
| 220 | 57, |
| 221 | 48, |
| 222 | 57, |
| 223 | 49, |
| 224 | 57, |
| 225 | 50, |
| 226 | 57, |
| 227 | 51, |
| 228 | 57, |
| 229 | 52, |
| 230 | 57, |
| 231 | 53, |
| 232 | 57, |
| 233 | 54, |
| 234 | 57, |
| 235 | 55, |
| 236 | 57, |
| 237 | 56, |
| 238 | 57, |
| 239 | 57} |
| 240 | ; |
| 241 | extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3579; |
| 242 | static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1) { |
| 243 | prepareAdd(s_p0, ((NI)1)); |
| 244 | (*(*s_p0).p).data[(*s_p0).len] = c_p1; |
| 245 | (*s_p0).len += ((NI)1); |
| 246 | (*(*s_p0).p).data[(*s_p0).len] = 0; |
| 247 | } |
| 248 | static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) { |
| 249 | void* T1_; |
| 250 | T1_ = (void*)0; |
| 251 | T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2))); |
| 252 | } |
| 253 | static N_INLINE(void, copyMem__system_u1726)(void* dest_p0, void* source_p1, NI size_p2) { |
| 254 | nimCopyMem(dest_p0, source_p1, size_p2); |
| 255 | } |
| 256 | static N_INLINE(void, addChars__stdZprivateZdigitsutils_u98)(NimStringV2* result_p0, tyArray__PbS9a6gkxCuxWEnFq4lOU9aw x_p1, NI start_p2, NI n_p3) { |
| 257 | NI old; |
| 258 | old = (*result_p0).len; |
| 259 | setLengthStrV2((&(*result_p0)), ((NI)(old + n_p3))); |
| 260 | copyMem__system_u1726(((void*) ((&(*result_p0).p->data[old]))), ((void*) ((&x_p1[(start_p2)- 0]))), (n_p3)); |
| 261 | } |
| 262 | static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { |
| 263 | NIM_BOOL* result; |
| 264 | result = (&nimInErrorMode__system_u3579); |
| 265 | return result; |
| 266 | } |
| 267 | static N_INLINE(void, addIntImpl__stdZprivateZdigitsutils_u55)(NimStringV2* result_p0, NU64 x_p1) { |
| 268 | tyArray__PbS9a6gkxCuxWEnFq4lOU9aw tmp; |
| 269 | NU64 num; |
| 270 | NI next; |
| 271 | NIM_BOOL* nimErr_; |
| 272 | {nimErr_ = nimErrorFlag(); |
| 273 | num = x_p1; |
| 274 | next = ((NI)23); |
| 275 | { |
| 276 | while (1) { |
| 277 | NU64 originNum; |
| 278 | NI16 index; |
| 279 | if (!((NU64)(100ULL) <= (NU64)(num))) goto LA2; |
| 280 | originNum = num; |
| 281 | num = (NU64)((NU64)(num) / (NU64)(100ULL)); |
| 282 | index = ((NI16) ((NU64)((NU64)((NU64)((NU64)(originNum) - (NU64)((NU64)((NU64)(num) * (NU64)(100ULL))))) << (NU64)(((NI)1))))); |
| 283 | tmp[(next)- 0] = digits100__stdZprivateZdigitsutils_u2[((NI16)(index + ((NI16)1)))- 0]; |
| 284 | tmp[((NI)(next - ((NI)1)))- 0] = digits100__stdZprivateZdigitsutils_u2[(index)- 0]; |
| 285 | next -= ((NI)2); |
| 286 | } LA2: ; |
| 287 | } |
| 288 | { |
| 289 | if (!((NU64)(num) < (NU64)(10ULL))) goto LA5_; |
| 290 | tmp[(next)- 0] = ((NIM_CHAR) (((NI) ((NU8)((NU8)(((NU8)48)) + (NU8)(((NU8) (num)))))))); |
| 291 | } |
| 292 | goto LA3_; |
| 293 | LA5_: ; |
| 294 | { |
| 295 | NU64 index_2; |
| 296 | index_2 = (NU64)((NU64)(num) * (NU64)(2ULL)); |
| 297 | tmp[(next)- 0] = digits100__stdZprivateZdigitsutils_u2[((NU64)((NU64)(index_2) + (NU64)(1ULL)))- 0]; |
| 298 | tmp[((NI)(next - ((NI)1)))- 0] = digits100__stdZprivateZdigitsutils_u2[(index_2)- 0]; |
| 299 | next -= ((NI)1); |
| 300 | } |
| 301 | LA3_: ; |
| 302 | addChars__stdZprivateZdigitsutils_u98(result_p0, tmp, next, (NI)(((NI)24) - next)); |
| 303 | if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; |
| 304 | }BeforeRet_: ; |
| 305 | } |
| 306 | N_LIB_PRIVATE N_NIMCALL(void, addInt__stdZprivateZdigitsutils_u175)(NimStringV2* result_p0, NU64 x_p1) { |
| 307 | NIM_BOOL* nimErr_; |
| 308 | {nimErr_ = nimErrorFlag(); |
| 309 | addIntImpl__stdZprivateZdigitsutils_u55(result_p0, x_p1); |
| 310 | if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; |
| 311 | }BeforeRet_: ; |
| 312 | } |
| 313 | N_LIB_PRIVATE N_NIMCALL(void, addInt__stdZprivateZdigitsutils_u178)(NimStringV2* result_p0, NI64 x_p1) { |
| 314 | NU64 numX60gensym3_; |
| 315 | numX60gensym3_ = (NU64)0; |
| 316 | { |
| 317 | if (!(x_p1 < IL64(0))) goto LA3_; |
| 318 | { |
| 319 | if (!(x_p1 == (IL64(-9223372036854775807) - IL64(1)))) goto LA7_; |
| 320 | numX60gensym3_ = ((NU64) (x_p1)); |
| 321 | } |
| 322 | goto LA5_; |
| 323 | LA7_: ; |
| 324 | { |
| 325 | numX60gensym3_ = ((NU64) (-(x_p1))); |
| 326 | } |
| 327 | LA5_: ; |
| 328 | nimAddCharV1((&(*result_p0)), 45); |
| 329 | } |
| 330 | goto LA1_; |
| 331 | LA3_: ; |
| 332 | { |
| 333 | numX60gensym3_ = ((NU64) (x_p1)); |
| 334 | } |
| 335 | LA1_: ; |
| 336 | addInt__stdZprivateZdigitsutils_u175(result_p0, numX60gensym3_); |
| 337 | } |