comparison src/data.c @ 2014:92f7301e4a23

[xemacs-hg @ 2004-04-15 15:27:34 by james] Fix GMP workaround to also work for negative numbers.
author james
date Thu, 15 Apr 2004 15:27:38 +0000
parents f2fdfc131770
children fd0cbe945410
comparison
equal deleted inserted replaced
2013:f2fdfc131770 2014:92f7301e4a23
1305 Ibyte *end, save; 1305 Ibyte *end, save;
1306 1306
1307 if (*p == '+') 1307 if (*p == '+')
1308 p++; 1308 p++;
1309 1309
1310 for (end = p; 1310 end = p;
1311 (*end >= '0' && *end <= '9') || 1311 if (*end == '-')
1312 end++;
1313 while ((*end >= '0' && *end <= '9') ||
1312 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || 1314 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) ||
1313 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); 1315 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11))
1314 end++); 1316 end++;
1315 if (*end == '/') 1317 if (*end == '/')
1316 for (end++; 1318 {
1317 (*end >= '0' && *end <= '9') || 1319 end++;
1318 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || 1320 if (*end == '-')
1319 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); 1321 end++;
1320 end++); 1322 while ((*end >= '0' && *end <= '9') ||
1321 1323 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) ||
1324 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11))
1325 end++;
1326 }
1322 save = *end; 1327 save = *end;
1323 *end = '\0'; 1328 *end = '\0';
1324 ratio_set_string (scratch_ratio, (const char *) p, b); 1329 ratio_set_string (scratch_ratio, (const char *) p, b);
1325 *end = save; 1330 *end = save;
1326 ratio_canonicalize (scratch_ratio); 1331 ratio_canonicalize (scratch_ratio);
1343 Ibyte *end, save; 1348 Ibyte *end, save;
1344 Lisp_Object retval; 1349 Lisp_Object retval;
1345 1350
1346 if (*p == '+') 1351 if (*p == '+')
1347 p++; 1352 p++;
1348 for (end = p; 1353 end = p;
1349 (*end >= '0' && *end <= '9') || 1354 if (*end == '-')
1355 end++;
1356 while ((*end >= '0' && *end <= '9') ||
1350 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) || 1357 (b > 10 && *end >= 'a' && *end <= 'a' + b - 11) ||
1351 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11); 1358 (b > 10 && *end >= 'A' && *end <= 'A' + b - 11))
1352 end++); 1359 end++;
1353 save = *end; 1360 save = *end;
1354 *end = '\0'; 1361 *end = '\0';
1355 if (*p == '\0') 1362 if (*p == '\0')
1356 retval = make_int (0); 1363 retval = make_int (0);
1357 else 1364 else